<?php
// Multidimensional array
$regions = [
"Kakheti"=> [
"city_1"=>"Telavi",
"city_2"=>"Gurjaani",
"city_3"=>"Kvareli",
"City_4"=>"Sighnaghi"
],
"ShidaKartli"=> [
"City_1"=>"Kaspi",
"City_2"=>"Gori",
"City_3"=>"Kareli",
"City_4"=>"Khashuri"
],
"Imereti"=> [
"city_1"=>"Kutaisi",
"city_2"=>"Zestafoni",
"city_3"=>"Terjola",
"City_4"=>"Chiatura"
]
];
echo 'Kakheti is the region of Georgia' . '.' . ' Its largest city is ' . $regions['Kakheti']['city_1'] . "\n";
echo 'My homeland is ' . $regions['ShidaKartli']['City_1'] . '.' . 'I like also ' . $regions['ShidaKartli']['City_2'] . "\n";
echo '2 years ago'. ',' . ' I visited to Imereti Firstly I went to ' . $regions['Imereti']['city_1'] . "\n";
echo 'after I went to '. $regions['Imereti']['city_3'] . ' and ' . $regions['Imereti']['city_2'] . "\n";
?>
<?php
$hello = "Hi!";
$a = 'hello';
echo $$a;
// output "Hi!"
?>
<?php
// associative array
$University = [
"name"=>"TSU",
"location"=>"Tbilisi",
"rating"=>"the best",
"faculty"=>"Social & Political Sciences",
"degree"=>"PhD"
];
echo 'Georgia has an ancient university '. $University['name'] . ' which is in ' . $University['location'] .'.' . "\n";
echo 'TSU is ' . $University['rating'] . ' in region' .'.' ."\n";
echo $University['name'] . ' is my university because I study there at the faculty of ' . $University['faculty'] .'.' . "\n";
echo 'my current level of teaching is ' . $University['degree'] .'.' . "\n";
?>
echo
is a statement, which is used to display the output.
For instance :
echo "Hello world! ";
echo "I am Prgorammer, ","I have no life."." Hola muchachos:))";
The text must be enclosed in single ( ' ' ) or double ( " " ) quotation marks and must also end with a semicolon ( ; ) .
Also, the echo statement can output multiple strings separated by commas and dots.
! PHP statements end with semicolons (;).