PHP 4.0 Bug #6414 Updated: foreach() doesn't accept string for an argument
| From: | Bug Database | Date: | Tue, 29 Aug 2000 15:12:32 +0000 |
| Subject: | PHP 4.0 Bug #6414 Updated: foreach() doesn't accept string for an argument | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-31075@lists.php.net to get a copy of this message | ||
ID: 6414
Updated by: jmoore
Reported By: cynic@mail.cz
Status: Closed
Bug Type: Scripting Engine problem
Assigned To:
Comments:
You need to cast your string as an array..
<?php
$b = "abcdefgh" ;
$b = (array)$b;
foreach( $b as $y ) {
echo $y ;
};
?>
Works.
James
Full Bug description available at: http://bugs.php.net/?id=6414