3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Attempt to reproduce "element" issue $url = urldecode( "eng%C3%A5%C2%BF%C2/Products" ); $elements = explode( $url ); #$elements = array( "eng%C3%A5%C2%BF%C2", "Products" );// url, exploded by "/" $saList = array( "eng", "fre" ); $URIMatchElement = 1;// URIMatchElement setting $elements = array_slice( $elements, 0, $URIMatchElement ); $name = implode( '_', $elements ); $name = preg_replace( array( '/[^a-zA-Z0-9]+/', '/_+/', '/^_/', '/_$/' ), array( '_', '_', '', '' ), $name ); echo $name . "\n"; echo (in_array( $name, $saList ) ? "is valid sa" : "is not valid sa");// if issue is true, then this should be true
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: explode() expects at least 2 parameters, 1 given in /in/toRXL on line 6 Warning: array_slice() expects parameter 1 to be array, null given in /in/toRXL on line 12 Warning: implode(): Invalid arguments passed in /in/toRXL on line 13 is not valid sa
Output for hhvm-3.10.0 - 3.13.2
Warning: explode() expects at least 2 parameters, 1 given in /in/toRXL on line 6 Warning: Invalid operand type was used: array_slice expects an array or collection as argument 1 in /in/toRXL on line 12 Warning: Invalid operand type was used: implode() expects a container as one of the arguments in /in/toRXL on line 13 is not valid sa
Output for 5.2.6 - 5.2.17
Warning: Wrong parameter count for explode() in /in/toRXL on line 6 Warning: array_slice() expects parameter 1 to be array, null given in /in/toRXL on line 12 Warning: implode(): Invalid arguments passed in /in/toRXL on line 13 is not valid sa
Output for 5.2.5
Warning: Wrong parameter count for explode() in /in/toRXL on line 6 Warning: array_slice(): The first argument should be an array in /in/toRXL on line 12 Warning: implode(): Invalid arguments passed in /in/toRXL on line 13 is not valid sa
Output for 4.3.2 - 5.0.5, 5.1.1 - 5.2.4
Warning: Wrong parameter count for explode() in /in/toRXL on line 6 Warning: array_slice(): The first argument should be an array in /in/toRXL on line 12 Warning: implode(): Bad arguments. in /in/toRXL on line 13 is not valid sa
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/toRXL on line 19
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Wrong parameter count for explode() in /in/toRXL on line 6 Warning: array_slice() [http://www.php.net/function.array-slice]: The first argument should be an array in /in/toRXL on line 12 Warning: implode() [http://www.php.net/function.implode]: Bad arguments. in /in/toRXL on line 13 is not valid sa