In the above example we use a single variable "$student_array".
We made use of
the key / value structure of an array.
The
keys
were the numbers we specified in the array and the values
were the names of the peoples.
Each key of
an array represents a
value that we can manipulate and reference.
The
general form for
setting the key of an array equal to a value is:
$array[key]
= value;
If we
wanted to reference the values that we stored into our array, the
following PHP code would get the job done.
PHP Code:
echo
"Two of my employees are " . $employee_array[0] . " &
" . $employee_array[1]; echo " Two more
employees of mine are " . $employee_array[2] . " & "
. $employee_array[3];
Display:
Two of my employees are Bob &
Sally Two more employees of mine are Charlie & Clare
There is another way of specifing an array, we called it an associative
array.
PHP - Associative
Arrays
Instead of using number as the key of an array, some descriptive name can be used as a key.
Array တခု၏ format မွာေအာက္ ေဖၚျပပါ အတိုင္း ျဖစ္ပါသည္။
$array[key]
= value;
PHP Code:
echo
"Two of my employees are " . $employee_array[0] . " &
" . $employee_array[1]; echo " Two more
employees of mine are " . $employee_array[2] . " & "
. $employee_array[3];
Display:
Two of my employees are Bob &
Sally Two more employees of mine are Charlie & Clare
All photograph,logos, articles, comments and trademarks -- etc in this site are property of their respective owners.All the rest (c) 2006 by PhpMyanmar.com.