Hi, I have this code in php to display the values of the array but I get an Array to string conversion error and I don't know why.
Code:
<?php
echo "<h3>Diferentes formas de array</h3>";
echo "Funcion array()";
$colores = array(
0=>'azul',
1=>'rojo',
2=>'verde');
echo "Resultado de la funcion es: ".$colores;
$colores2 = array("azul","rojo","verde");
echo "Valor del array: ".$colores2;
?>
The message says it all: you can't convert an array to a string .
To do this, you can use the function
implode
In your case: