0

Hello guys i'm getting data from xml to php and i want to make limit. for example get only 10 post down is a examples of my xml file and php code

This is xml file from where i'm getting data : http://myscandal.ge/sitemap.xml

And there is a php code, so i'm getting data from xml file :

http://mymus.ge/example.txt

L. P.
  • 113
  • 11
  • You should list your code **in the question body** if you are interested in answers. Links can change over time, making the question much less relevant in the future, and many people avoid links to unknown websites for security reasons. – Claies Sep 12 '16 at 04:51

1 Answers1

1

Put a counter inside your foreach loop and break when it reaches the limit you want. Something like

$countrer = 0;
foreach(..){ 
   // your code here
  $counter++; 
  if($counter == X) break;
}

Where X the number of results you want.

iliaz
  • 395
  • 2
  • 10