Scripts

functie: XML info

Iemand vroeg net naar zo iets op het forum en had nog wat liggen. Code van het voorbeeld:

functie-xml-info
<?php
	function xmlinfo($str, $row, $limit=null, $attr=NULL)
	{
		if($attr != NULL)
		{
			preg_match_all("|<$row.*$attr=\"(.*)\".*>.*</$row>|U", $str, $xmlinfo);
		}else{
			preg_match_all("|<$row.*>(.*)</$row>|U", $str, $xmlinfo);
		}
		if($limit != null)
		{
			$xmlinfo = array_slice($xmlinfo[1], 0, $limit);
		}else{
			$xmlinfo = $xmlinfo[1];
		}
		return $xmlinfo;
	}
?>

Reacties

0
Nog geen reacties.