3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bigKml = "<Document><name>test2.kmz</name><br><img src='files/bagel.png'><br><br></Document>"; $titleTagPattern = '/<Document><name>.*?<\/name>/'; preg_match($titleTagPattern, $bigKml, $titleTags); $titleTag = $titleTags[0]; $len = strlen($titleTag); $docTagLen = 16; $nameEndTagLen = 7; $title = substr($titleTag, $docTagLen, $len - $docTagLen - $nameEndTagLen); print_r($title . "\n"); $imgPattern = "/<img src=.*?>/"; preg_match($imgPattern, $bigKml, $imageTags); print_r($imageTags); foreach($imageTags as $imageTag) { $urlPattern = "/'([^']*)'/"; preg_match($urlPattern, $imageTag, $oldUrls); $oldUrl = $oldUrls[1]; //the second element contains the match without the quotes print_r($oldUrl . "\n"); $newUrl = "/var/www/resources/" . $oldUrl; print_r($newUrl . "\n"); } ?>
Output for git.master, git.master_jit, rfc.property-hooks
test2.kmz Array ( [0] => <img src='files/bagel.png'> ) files/bagel.png /var/www/resources/files/bagel.png

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
58.59 ms | 401 KiB | 8 Q