How to get ref of an array in PHP 5 ?
Posted
by Relax
on Stack Overflow
See other posts from Stack Overflow
or by Relax
Published on 2010-04-09T15:02:41Z
Indexed on
2010/04/09
15:13 UTC
Read the original article
Hit count: 325
In php 5, all variable and objects are passed by reference, but i can't get my codes work
My codes is:
$arrayA = array();
$array = $arrayA;
...
if(!in_array(thedata, $array) // if i use & to get ref, got an error here, should i use *$array here?
$array[] = thedata;
var_dump($arrayA);
The result is empty, am i missing something simple?
© Stack Overflow or respective owner