I have this xml response to which I will do a
foreach($response->entry->item as $data)
but $data contains more arrays (20) than I need (18). So I tried doing array_slice but as you know it won’t work.
What other solutions could I try?
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.
You could try restricting the result set from the data you select from your xml via xpath.
As was suggested from the comments you could also just loop over the array with
forinstead offoreachand restrict the number of iterations.