$auto[“nexia” ]= array(“y ili”= > “1999”, “rangi”= > “o q ”); $auto[“dam as”] = array(“y ili”= > “2003”, “rangi”= > “qora”); $auto[“m atiz”] = array(“y ili”= > “2005”, “rangi”= > “oq”); $auto[“tiko”]= array(“y ili”= > “ 1999”, “rangi”= > “q izil”); echo “M atiz avtom obilini ishlab chiqarilgan yili - $auto[“m atiz”] [“y ili’i ; ?> Natija. Matiz avtom obilini ishlab chiqarilgan yili — 2005_______________________ M assiv kalitlari A g ar k alit b e rilm a g a n b o is a , u h o ld a k alit o ‘rn ig a k a litn in g eng
k a tta q iy m atig a 1 so n in i q o ‘shib yozib ketilad i. K a lit b iro r-b ir qiy-
m atg a te n g b o is a , u h o ld a o 's h a q iy m a t o ‘zi y o zilad i. P H P n in g
4.3.0 d a n k eyingi versiy alarid a k a litn in g eng k a tta q iy m ati m a n fiy
son b o is a , m a ssiv n in g keyingi qiy m ati nol(0) deb o lin a d i.
A g a r k alit o ‘rn id a T R U E yoki F A L S E q iy m a tla ri ish la tilsa , u
h o ld a kalit tip i in te g e r b o lg a n 0 yoki 1 q iy m a tn i b erad i. K a lit o ‘rn id a
N U L L ish la tilsa , b o ‘sh s a trn i b erad i. K alit o ‘rn id a b o ‘sh s a tr h a m
ish la tilish i m u m k in , faqat u n i q o ‘s h tirn o q ichiga olib y ozish k erak
yoki a lo h id a y o zilg an d a b o ‘sh to 'rtb u rc h a k qavs is h la tila d i. K alit
o ‘rn id a obyekt va m assiv lar ish latilm ay d i.
2 .8 -m iso l. P H P d a m a ssiv la rn in g ish la tilish i
/ / $arr va Sarrl massivlari ekvivalent
$arr = array(-3 => 43, 32, 56, 86, 97, “b” => 12);
Sarrl = array(-3 => 43, 0 => 32, 1 => 56, 2=> 86, 3 => 97, “b” => 12,
“s” => true, “ “ => 28);
Echo $arrl[null];?>____________________________________________________ A g ar yangi k alit va yangi q iy m at b erilsa
($ n a m e [“new _
key” ] = ”new _value” ), u h o ld a m assivga yangi elem en t q o ‘sh ilg an h i-
so b lan ad i. A g a r biz k a litn i ko‘rsa tm asa k , fa q atg in a q iy m atg a te n g la -
sak, $ n a m e [ ]= ”new _value”, u h o ld a m assiv n in g yangi elem en ti so nli
k alit b o iib , m avjud k a litn in g eng k a tta q iy m a tid a n b ir qiym atga
o sh g a n b o ia d i.
$name=array(2=>5, 3=>6, 4=>15);
$name[] = valuel;________________________________________________