Can someone please acknowledge that the following is a bug with PHP 5.2.13: (thanks)
<?php
session_start();
if (!is_array($_SESSION["breadcrumb"]["trail"]))
{
$_SESSION["breadcrumb"]["trail"][] = "trail";
}
foreach ($_SESSION["breadcrumb"]["trail"] as $breadcrumb)
{
echo $breadcrumb;
}
?>
The aforementioned PHP script will work the third time it is run. It seems that the foreach () loop has a (inappropriate) side effect that wipes out the $ _SESSION nested array, because the internal variable used in the loop matches the name of the nested $ _SESSION array. Just changing the name of the foreach () internal variable to something else fix the problem.
Note: clear session variables before running the script 3 times.
, "$ breadcrumb" "$ the_breadcrumb" . foreach() . : $breadcrumb $_SESSION [ "breadcrumb" ], .
, print_r() , () () " ([ ] = > " ), ( ).
PHP :
PHP : 5
PHP 5.3 - PHP 5.2.13. PHP- PHP PHP (php.net), 5.2.13 , , , - . php.net.
,
:
5.2 5.2.2.
:
PHP 5.2.13 5.