<?php
$a=$_POST["t1"];
$ar=$array("gujarat"=>"gandhinagar"
,"mumbai"=>"maharashtra"
,"madras"=>"channie");
echo "capital is=" . $ar;
?>
Parse error: syntax error, unexpected T_DOUBLE_ARROW in C:\xampp\htdocs\capital.php on line 4
You have a dollar sign ($
) before array()
, which is causing PHP to interpret this as a reference to the $array
variable, when in fact you want to create a new array:
$ar=$array("gujarat"=>"gandhinagar"
^
Here