php - What type of array is this and how to display this array -


how display using php , type of array please explain

array (     [name] => ajin     [username] => ajin     [password] => password ) 

it's associative array. how can define it:

$array = array('name' => 'ajin', 'username' => 'ajin', 'password' => 'password'); 

and can output print_r():

print_r($array); 

it outputs:

array (     [name] => ajin     [username] => ajin     [password] => password ) 

you can read more array in manual. can example iterate through array using foreach display it:

foreach ($array $key => $value) {   echo $key . ': ' . $value . php_eol; } 

this outputs:

name: ajin username: ajin password: password 

or can access individual values $array['name']:

echo $array['name']; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -