Asking a simple question,
$a = [array(]2, 4, 6, 8);
echo $a;
why return Array in html page and not the numbers?
Asking a simple question,
$a = [array(]2, 4, 6, 8);
echo $a;
why return Array in html page and not the numbers?
Firstly, that's not the way to declare an array in php. You declare it like this:
$a = array(2, 4, 6, 8);
or like this:
$a = [ 2, 4, 6, 8 ];
Secondly, "echo" prints strings. An array is not a string. If you want to print the contents of an array you can use:
print_r($a);
or:
var_dump($a)
or:
foreach($a as $number)
{
echo($number.' ');
}
or:
echo(implode(',', $a));
or:
echo($a[0]);
echo($a[1]);
// etc