ID:               28809
 Comment by:       imprestavel at gameguru dot com dot br
 Reported By:      chris at arbo-com dot fr
 Status:           Open
 Bug Type:         Output Control
 Operating System: linux redhat 7.3 kernel 2.4.x
 PHP Version:      4.3.7
 New Comment:

True. Printf changed behavior, now it seems to return result string
length (instead of void).
But I think there is also a bug in your code:
<?=printf("%02d<br>",$i)?>
  ^^

You could try:
<?=sprintf("%02d<br>",$i)?>
or:
<?printf("%02d<br>",$i);?>

Because <?='string'?> echoes 'string'
This means that it will echo the return of printf. When it was void,
there was no visual problem.


Previous Comments:
------------------------------------------------------------------------

[2004-06-17 00:11:38] chris at arbo-com dot fr

Description:
------------
when use printf with <?=printf
the output is not identical at older version of php

Now the printf send the true string, but add after the nombre of send
caractere.

the documentation of printf retur void et not the nombre of caractere
send.

Reproduce code:
---------------
<?
        for($i=0; $i<=4; $i++)
        {
?>
my line <?=printf("%02d<br>",$i) ?>
<?php

        }
?>

Expected result:
----------------
with old version printf not send nombre of caractere write on flux.

Actual result:
--------------
my line 00
6my line 01
6my line 02
6my line 03
6my line 04
6


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=28809&edit=1

Reply via email to