We have 39 guests online
PHP Scripts arrow Free PHP Tutorials arrow Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP 
Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP

Get data between 2 elements or tags
User Rating: / 2
PoorBest 
Retrieves data from between 2 specified beginning and ending elements or tags. Could be used to read data out of an xml document.
  1. <?php
  2. function find($string,$opener,$closer)
  3. {   $part1 = explode($opener,$string);
  4.     $part2 = explode($closer,$part1[1]);
  5.     $result = $part2[0];
  6.     return $result;
  7. }
  8.  
  9. // Example for use:
  10. $string = "<data>Here is stuff</data>"
  11. $data = find($string,"<data>","</data>"); // would set $data to "Here is stuff".
  12. ?>

 

 

Directory Stats

There are 1036 listing and 46 categories in our website

Change Language