3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $paths = array( 'invalid path', 'http://myhost.com/image.jpg', 'https://mysslhost.com/image.jpg', ); foreach ($paths as $path) { $is_full_path = 0 !== preg_match('@^http:\/\/@', $path); echo $path . ' ' . ($is_full_path ? 'YES' : 'NO') . ' is a full path' . PHP_EOL; }
based on Jumlj
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
invalid path NO is a full path http://myhost.com/image.jpg YES is a full path https://mysslhost.com/image.jpg NO is a full path
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/D5kUF on line 12 invalid path NO is a full pathPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/D5kUF on line 12 http://myhost.com/image.jpg YES is a full pathPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/D5kUF on line 12 https://mysslhost.com/image.jpg NO is a full pathPHP_EOL