Array values changing unexpectedly
Posted
by Lizard
on Stack Overflow
See other posts from Stack Overflow
or by Lizard
Published on 2010-06-10T11:11:39Z
Indexed on
2010/06/10
11:42 UTC
Read the original article
Hit count: 145
I am using cakephp 1.2 and I have an array that appears to have a value change even though that variable is not being manipulated. Below is the code to that is causing me trouble.
PLEASE NOTE - UPDATE Changing the variable name makes no difference to the outcome, The values get changed somewhere between the two print_r calls, and I can't see why the $this->find would do this .
echo "Start of findCountByString()";
print_r($myArr);
$test = $this->find('count', array(
'conditions' => $conditions,
'joins' => array('LEFT JOIN `articles_entities` AS ArticleEntity ON `ArticleEntity`.`article_id` = `Article`.`id`'),
'group' => 'Article.id'
));
echo "End of findCountByString()";
print_r($myArr);
I am getting the following output:
Start of findCountByString()
Array
(
[0] => 4bdb1d96-c680-4c2c-aae7-104c39d70629
[1] => 4bdb1d6a-9e38-479d-9ad4-105c39d70629
[2] => 4bdb1b55-35f0-4d22-ab38-104e39d70629
[3] => 4bdb25f4-34d4-46ea-bcb6-104f39d70629
)
End of findCountByString()
Array
(
[0] => 4bdb1d96-c680-4c2c-aae7-104c39d70629
[1] => 4bdb1d6a-9e38-479d-9ad4-105c39d70629
[2] => 4bdb1b55-35f0-4d22-ab38-104e39d70629
[3] => '4bdb25f4-34d4-46ea-bcb6-104f39d70629' # This is now in inverted commas
)
The the value in my array have changed, and I don't know why?
Any suggestions?
© Stack Overflow or respective owner