Sizeof variable variable arrays
| From: | Neil Freeman | Date: | Fri, 11 Jan 2002 12:02:56 +0000 |
| Subject: | Sizeof variable variable arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-80191@lists.php.net to get a copy of this message | ||
Hi there guys,
Who's awake today then? :) What I'm trying to do is create variable
variable arrays and then fill these arrays with values. The problem I
have though is that the values don't appear to be getting stored - as
following the assignment I have outputted a 'sizeof' command which
always outputs 0.
Here's a snippet of the code. Any ideas guys???
...........
//store children page_IDs into array for each parent
$str_array = "menu_array_" . $current_parent_page_ID;
$$str_array = array();
for ($child_cnt = 0; $child_cnt < $number_children; $child_cnt++)
{
$db_help_structure->next_record();
//get page_ID value
$page_ID = $db_help_structure->return_single_result('page_ID');
//$page_ID is now set
echo "storing in $str_array position $child_cnt:" . $page_ID .
"<br>";
$$str_array[$child_cnt] = $page_ID;
echo "size:" . sizeof($$str_array) . "<br>";
}
...........
--------------------------------
Email: neil.freeman@asa.co.uk
neil_freeman@yahoo.com
--------------------------------