I saw this in a php script about reading a csv file:
array($mydata);
What does it make? An array from $mydata?
I saw this in a php script about reading a csv file:
array($mydata);
What does it make? An array from $mydata?
Yes, it creates an array where $mydata
is the first element. You can even put many elements in there at once:
php > $x = array(1,2,3);
php > var_dump($x);
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
However, if that was all that happened on that line, I'd say nothing happens at all. array()
behaves like a function that returns a new array, if it wasn't assigned to anything it was simply discarded and nothing happened. Example:
php > $y = 'foo';
php > array($y);
php > var_dump($y);
string(3) "foo"