3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _getYoutubeVideoId($url) { $parts = parse_url($url); //For seriously malformed urls if ($parts === false) { return false; } switch ($parts['host']) { case 'youtu.be': return substr($parts['path'], 1); break; case 'youtube.com': case 'www.youtube.com': parse_str($parts['query'], $params); return $params['v']; break; default: return false; break; } } var_dump(_getYoutubeVideoId("http://www.youtube.com/watch?v=WQq0RAbj4i8"));
Output for git.master, git.master_jit, rfc.property-hooks
string(11) "WQq0RAbj4i8"

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