Data questions !! With this result, 024 is the title by accident. 1, 3, and 5 are the IDArray (& nbsp; [0] & gt; of this title. Have you eaten it today! & Nbsp; [1] & gt; 2 & nbsp; [2] & gt; no more today! & Nbsp; [3] & gt; 3 & nbsp; [4] & gt; Ele. me today! & Nbsp data questions !!
With such a result, 0 2 4 happens to be the title, and 1, 3, and 5 indicate the ID of the title.
Array
(
[0] => have you eaten today!
[1] => 2
[2] => don't eat it today!
[3] => 3
[4] => today is really hungry!
[5] => 8
)
How can this problem be solved?
Don't eat it today! (Id = 3)
------ Solution --------------------
With such a result, 0 2 4 happens to be the title, and 1, 3, and 5 indicate the ID of the title.
------ Solution --------------------
PHP code
$ Ar = array (0 => 'Have you eaten today! ', 2,' don't eat today! ', 3,' it's really hungry today! ', 8,); foreach (array_chunk ($ ar, 2) as $ v) $ list [] = array ('id' => $ v [1], 'name' => $ v [0]); print_r ($ list );
------ Solution --------------------
PHP code
$ Array = array ('heading 1', 'id1', 'heading 2', 'id2', 'heading 3', 'id3 '); foreach ($ array as $ key => $ value) {if (isset ($ array [$ key + 1]) $ id = $ array [$ key + 1]; echo ''. $ value. '(id = '. $ id. ')
';}
------ Solution --------------------
PHP code
$ Array = array (); $ arrList = array (); for ($ I = 0; $ I
------ Solution --------------------
PHP code
$ Array = array ('id1', 'heading 1', 'id2', 'heading 2', 'id3 ', 'heading 3'); foreach (range (1, count ($ array) * 1/2) as $ val) {echo "". next ($ array ). "\ r \ n"; next ($ array );}