foreach ($data['data'] as $data) {
echo $data['title'][0];
//echo '<br />';
}
this will print out:
melon
apple
...
banana
pear
Now, how to jump all, only get the last value in a foreach? only need pear. Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you only need the last value, then you don’t need to loop. You can use
end():Note that this will set the internal array pointer to the last element. It might be necessary that you call
reset($data)afterwards.