ID:               6414
 Updated by:       [EMAIL PROTECTED]
 Reported By:      cynic at mail dot cz
 Status:           Closed
-Bug Type:         Scripting Engine problem
+Bug Type:         Feature/Change Request
-Operating System: NT 4.0 SP5
+Operating System: ANY
-PHP Version:      4.0 Latest CVS (29/08/2000)
+PHP Version:      5.0
 New Comment:

This is a thing to think about:
Since strings are NOT accepted as foreach input we could
add that by delivering eash single character.

>php -r '$a="abc";foreach($a as $i => $c) echo "$i:$c\n";'
0:a
1:b
2:c



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

[2003-03-17 01:46:32] yuki_yew78 at yahoo dot com

me too

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

[2000-08-29 11:12:32] [EMAIL PROTECTED]

You need to cast your string as an array..

<?php

$b = "abcdefgh" ;
$b = (array)$b;

foreach( $b as $y ) {
        echo $y ;
};

?>

Works.

James

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

[2000-08-29 10:47:05] cynic at mail dot cz

$b = "abcdefgh" ;

foreach( $b as $y ) {
        echo $y ;
} ;

Warning: Invalid argument supplied for foreach() 

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


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

Reply via email to