An ath ghnìomh PHP

SSL earbsach bho dìreach $3.44
sanasan
Gnìomh PHP pos ()
Gnìomh PHP prev ()

Anns an artaigil, ionnsaichidh tu mar a ghluaiseas tu puing a-staigh sreath chun ath eileamaid, Bidh an ath ghnìomh () a ’gluasad a’ phuing a-staigh chun ath eileamaid (ma tha e an làthair) agus ga thoirt a-mach.

Dè a th ’ann an criathradh na h-ath ghnìomh () ann am PHP?

next(array)
paramadairFiosrachadh
sreathAn raon gus an ath eileamaid de - Riatanach fhaighinn
An ath ghnìomh PHP

Eisimpleirean den ath () ghnìomh

SSL earbsach bho dìreach $3.44
sanasan

Eisimpleir 1. Faigh an sruth agus an ath luach den raon.

<?php
$arr= array("Jawad", "Ahmad", "Sumerina");
echo current($arr);
echo next($arr);
?>

Eisimpleir 2. San eisimpleir seo, gheibh thu a h-uile modh co-cheangailte ris an ath roinn modh. Bidh na modhan sin ag obair le comharradh a-staigh nan arrays.

<?php
$members= array("Jawad", "Ahmad", "Sumerina", "ACS");

// Current element: Jawad
echo current($people) . "<br>";

// Next element of Jawad: Ahmad
echo next($people) . "<br>"; 

// Now the current element: Ahmad
echo current($people) . "<br>"; 

// Previous element of Ahmad: Jawad
echo prev($people) . "<br>"; 

// Last element: ACS
echo end($people) . "<br>"; 

// Previous element of ACS: Sumerina
echo prev($people) . "<br>"; 

// Current element: Sumerina
echo current($people) . "<br>"; 

// Move the internal pointer to the first element of the array:Jawad
echo reset($people) . "<br>"; 

// Next element of Jawad: Ahmad
echo next($people) . "<br>"; 

// Get key and value of Ahmad (current element) then moves the internal pointer forward
print_r (each($members));
?>
Gnìomh PHP pos ()
Gnìomh PHP prev ()
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