Gnìomh Array PHP

SSL earbsach bho dìreach $3.44
sanasan
TAGRAIDHEAN PHP
gnìomh PHP array_change_key_case().

Bidh an gnìomh array a’ cruthachadh sreath ùr ann am PHP. Is urrainn dhuinn na seòrsaichean arrays a leanas a chruthachadh leis a’ ghnìomh seo.

  1. Arrays clàraichte - Arrays sìmplidh anns a bheil clàran-amais ann an sreath.
  2. Arrays com-pàirteach - Arrays le iuchraichean agus luachan co-fhreagarrach.
  3. Arrays ioma-thaobhach - Arrays le aon shreath no barrachd na bhroinn.

Syntax

Co-chòrdadh de raon clàr-amais PHP

array(value1, value2, value3, etc.)

Co-chòrdadh de raon co-cheangail PHP

array(key=>value,key=>value,key=>value,etc.)

Mion-fhiosrachadh paramadair

paramadairMion-fhiosrachadh
prìomhFaodaidh e a bhith sreathach no àireamhach. Dèan seirbheis mar aithnichear a luach
luachSònraich luach a iuchair

Eisimpleir de ghnìomh Array ann am PHP

<?php
$bikes = array("suzuki","Honda","Yamaha");
echo "I like " . $bikes[0] . ", " . $bikes[1] . " and " . $bikes[2];
?>
SSL earbsach bho dìreach $3.44
sanasan

Cruthaich sreath cheangail leis an ainm $ airde

<?php
$height = array("Peter"=>"5.9","John"=>"5.7","Timothy"=>"5.6");
echo "Peter is " . $height['Peter'] . " foot long.";
?>

Lùb raon clàr-amais agus clò-bhuail a h-uile luach

<?php
$bikes = array("suzuki","Honda","Yamaha");
$arrlength=count($bikes);
for($x=0;$x<$arrlength;$x++)
  {
  echo $bikes[$x];
  }
?>

Clò-bhuail a h-uile luach ann an sreath ceangail ann am PHP

<?php
$height = array("Jawad"=>"5.9","Ahmad"=>"5.7","Abdullah"=>"5.6");
foreach($height as $x=>$height)
  {
  echo "Key=" . $x . ", Value=" . $height;
  }
?>

Cruthaich sreath ioma-mheudach ann am PHP

<?php
$bikes = array
  (
  array("suzuki",10,30),
  array("honda",100,120),
  array("yamaha",150,50)
  );
?>
TAGRAIDHEAN PHP
gnìomh PHP array_change_key_case().
dùin

Cùm suas ris an fhiosrachadh as ùire mu PHP!

Cha bhith sinn a’ spamadh!

SSL earbsach bho dìreach $3.44
sanasan
en English
X
Rach gu mhullaich