3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $text = 'http://www.twitter.com/monica'; $text = preg_replace_callback( '~ (?<=^|\s) # positive looke behind, check for start of string or whitespace https?:// # match this caracters with an optional s (\S+) # capure group, all non whitespace chars ~ix', function ( $matches ) { return '<a href="' . esc_url( $matches[0] ) . '">' . $matches[1] . '</a>'; }, $text ); echo $text;
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function esc_url() in /in/TZK5s:11 Stack trace: #0 [internal function]: {closure}(Array) #1 /in/TZK5s(12): preg_replace_callback('~\n\t\t\t(?<=^|\\s) ...', Object(Closure), 'http://www.twit...') #2 {main} thrown in /in/TZK5s on line 11
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Fatal error: Call to undefined function esc_url() in /in/TZK5s on line 11
Process exited with code 255.