5
I got the following array
:
$array = array(10,20,30);
print_r($array);
Exit:
Array
(
[0] => 10
[1] => 20
[2] => 30
)
If I print with echo
before the print_r
:
echo 'primeiro: ';
print_r($array);
Exit:
primeiro: Array
(
[0] => 10
[1] => 20
[2] => 30
)
If I print concatenating, the print_r
is printed before:
echo 'primeiro: ' . print_r($array);
Exit:
Array
(
[0] => 10
[1] => 20
[2] => 30
)
primeiro: 1
Still, print that one 1
in front of the primeiro
.
Why does this happen? What is this 1
?
I think it will be interesting to say that with parameter
return
totrue
will give exactly the result that the author of the question intended, and perhaps exemplifying what it would call in this case.– Isac