Relative Content

Tag Archive for phparrays

PHP: Put an Array into One of the Elements in Another Array

$a = array(“red”,”green”,”blue”,”yellow”); $b = []; When attempting: for ($x = 0; $x <= 10; $x++): $b[$x] = $a; echo “b[” . $x . “] = ” . $b[$x] . “<br />”; endfor; The following warning appears. “Array to string conversion” on the line with the echo. However, no warning appears when the echo line […]