3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_tumbail($imgSrc,$placeholder_image){ $imgPattern = "/(http\:\/\/ww\d+\.sinaimg\.cn\/)(\w+)(\/\S+\.(jpg|gif))/i"; $matches = null; $result = preg_match($imgPattern, $imgSrc, $matches); if (!$result) { return $placeholder_image; } return $matches[1] . 'thumbnail' . $matches[3]; } $placeholder_image = 'images/transparent.gif'; $imgStr = '<img src="http://ww2.sinaimg.cn/bmiddle/a3d444e3jw1ez79amvdi1j20l50s8gpl.jpg"/>'; $imgStr = preg_replace_callback('#<img([^>]+?)src=[\'"]?([^\'"\s>]+)[\'"]?([^>]*)>#',function($match,$placeholder_image) { var_dump($match); return sprintf('<img$match[1]src="%s" data-original="$match[2]" class="lazy"$match[3]><noscript><img${1}src="${2}"${3}></noscript>', get_tumbail($match[2],$placeholder_image)); },$imgStr); var_dump($imgStr);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed and exactly 2 expected in /in/sttBf:13 Stack trace: #0 [internal function]: {closure}(Array) #1 /in/sttBf(13): preg_replace_callback('#<img([^>]+?)sr...', Object(Closure), '<img src="http:...') #2 {main} thrown in /in/sttBf on line 13
Process exited with code 255.

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:
57.09 ms | 401 KiB | 8 Q