3v4l.org

run code in 300+ PHP versions simultaneously
<?php function wp_is_stream( $path ) { if ( false === strpos( $path, '://' ) ) { // $path isn't a stream return false; } $wrappers = stream_get_wrappers(); $wrappers = array_map( 'preg_quote', $wrappers ); $wrappers_re = '(' . join( '|', $wrappers ) . ')'; return preg_match( "!^$wrappers_re://!", $path ) === 1; } function wp_is_stream2( $path ) { $scheme_separator = strpos( $path, '://' ); if ( false === $scheme_separator ) { // $path isn't a stream return false; } $stream = substr( $path, 0, $scheme_separator ); return in_array( $stream, stream_get_wrappers(), true ); } print( "Testing:\n" ); $tests = [ 'test', 'php://test', 'http://test', 'unknown://test', '://', 'unknown://php://test', ]; foreach ( $tests as $test ) { printf( "%-20s - wp_is_stream() => %-5s - wp_is_stream2() => %s\n", $test, wp_is_stream( $test ) ? 'true' : 'false', wp_is_stream2( $test ) ? 'true' : 'false' ); } $test_stream = 'php://test/stream'; $iterations = 1000000; $wp_start = microtime( true ); for( $i = 0; $i < $iterations; $i++ ) { $result = wp_is_stream( $test_stream ); } $wp_end = microtime( true ); $wp_start2 = microtime( true ); for( $i = 0; $i < $iterations; $i++ ) { $result = wp_is_stream2( $test_stream ); } $wp_end2 = microtime( true ); $wp_time = $wp_end - $wp_start; $wp_time2 = $wp_end2 - $wp_start2; print( "\nBenchmarking:\n" ); printf( "wp_is_stream() => %f seconds for %d iterations\n" . "wp_is_stream2() => %f seconds for %d iterations\n", $wp_time, $iterations, $wp_time2, $iterations ); printf( "Refactor improved execution time by %d percent.\n", ( $wp_time - $wp_time2 ) / $wp_time * 100 );

Abusive script

This script was stopped while abusing our resources

Output for 5.6.38, 7.1.3, 7.1.7 - 7.1.8, 7.1.17, 7.2.33, 7.3.21, 7.4.8 - 7.4.10
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false
Process exited with code 137.
Output for 7.3.22
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.786480 seconds for 1000000 iterations wp_is_stream2() => 0.383594 seconds for 1000000 iterations Refactor improved execution time by 78 percent.
Output for 7.2.12
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.217770 seconds for 1000000 iterations wp_is_stream2() => 0.268830 seconds for 1000000 iterations Refactor improved execution time by 77 percent.
Output for 7.2.11
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.136546 seconds for 1000000 iterations wp_is_stream2() => 0.275939 seconds for 1000000 iterations Refactor improved execution time by 75 percent.
Output for 7.2.10
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.249344 seconds for 1000000 iterations wp_is_stream2() => 0.364837 seconds for 1000000 iterations Refactor improved execution time by 70 percent.
Output for 7.2.9
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.355735 seconds for 1000000 iterations wp_is_stream2() => 0.274376 seconds for 1000000 iterations Refactor improved execution time by 79 percent.
Output for 7.2.8
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.399669 seconds for 1000000 iterations wp_is_stream2() => 0.347356 seconds for 1000000 iterations Refactor improved execution time by 75 percent.
Output for 7.2.7
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.292452 seconds for 1000000 iterations wp_is_stream2() => 0.328509 seconds for 1000000 iterations Refactor improved execution time by 74 percent.
Output for 7.2.6
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.452649 seconds for 1000000 iterations wp_is_stream2() => 0.354453 seconds for 1000000 iterations Refactor improved execution time by 75 percent.
Output for 7.2.5
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.475923 seconds for 1000000 iterations wp_is_stream2() => 0.289501 seconds for 1000000 iterations Refactor improved execution time by 80 percent.
Output for 7.2.4
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.270237 seconds for 1000000 iterations wp_is_stream2() => 0.269709 seconds for 1000000 iterations Refactor improved execution time by 78 percent.
Output for 7.2.3
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.176533 seconds for 1000000 iterations wp_is_stream2() => 0.293497 seconds for 1000000 iterations Refactor improved execution time by 75 percent.
Output for 7.2.2
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.318338 seconds for 1000000 iterations wp_is_stream2() => 0.267803 seconds for 1000000 iterations Refactor improved execution time by 79 percent.
Output for 7.2.1
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.697394 seconds for 1000000 iterations wp_is_stream2() => 0.322862 seconds for 1000000 iterations Refactor improved execution time by 80 percent.
Output for 7.2.0
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.226602 seconds for 1000000 iterations wp_is_stream2() => 0.281001 seconds for 1000000 iterations Refactor improved execution time by 77 percent.
Output for 7.1.24
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.489187 seconds for 1000000 iterations wp_is_stream2() => 0.318776 seconds for 1000000 iterations Refactor improved execution time by 78 percent.
Output for 7.1.23
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.893256 seconds for 1000000 iterations wp_is_stream2() => 0.309628 seconds for 1000000 iterations Refactor improved execution time by 83 percent.
Output for 7.1.22
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.686717 seconds for 1000000 iterations wp_is_stream2() => 0.326894 seconds for 1000000 iterations Refactor improved execution time by 80 percent.
Output for 7.1.21
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.672389 seconds for 1000000 iterations wp_is_stream2() => 0.361940 seconds for 1000000 iterations Refactor improved execution time by 78 percent.
Output for 7.1.20
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.724024 seconds for 1000000 iterations wp_is_stream2() => 0.472395 seconds for 1000000 iterations Refactor improved execution time by 72 percent.
Output for 7.1.19
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.702046 seconds for 1000000 iterations wp_is_stream2() => 0.307578 seconds for 1000000 iterations Refactor improved execution time by 81 percent.
Output for 7.1.18
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.814809 seconds for 1000000 iterations wp_is_stream2() => 0.322294 seconds for 1000000 iterations Refactor improved execution time by 82 percent.
Output for 7.1.16
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.668194 seconds for 1000000 iterations wp_is_stream2() => 0.308092 seconds for 1000000 iterations Refactor improved execution time by 81 percent.
Output for 7.1.15
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.789397 seconds for 1000000 iterations wp_is_stream2() => 0.319329 seconds for 1000000 iterations Refactor improved execution time by 82 percent.
Output for 7.1.14
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.523086 seconds for 1000000 iterations wp_is_stream2() => 0.518790 seconds for 1000000 iterations Refactor improved execution time by 65 percent.
Output for 7.1.13
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.635195 seconds for 1000000 iterations wp_is_stream2() => 0.368455 seconds for 1000000 iterations Refactor improved execution time by 77 percent.
Output for 7.1.12
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.689365 seconds for 1000000 iterations wp_is_stream2() => 0.320284 seconds for 1000000 iterations Refactor improved execution time by 81 percent.
Output for 7.1.11
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.611090 seconds for 1000000 iterations wp_is_stream2() => 0.319353 seconds for 1000000 iterations Refactor improved execution time by 80 percent.
Output for 7.1.10
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.569179 seconds for 1000000 iterations wp_is_stream2() => 0.308753 seconds for 1000000 iterations Refactor improved execution time by 80 percent.
Output for 7.1.9
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.611414 seconds for 1000000 iterations wp_is_stream2() => 0.459655 seconds for 1000000 iterations Refactor improved execution time by 71 percent.
Output for 7.1.6
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.556868 seconds for 1000000 iterations wp_is_stream2() => 0.316864 seconds for 1000000 iterations Refactor improved execution time by 79 percent.
Output for 7.1.5
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.499481 seconds for 1000000 iterations wp_is_stream2() => 0.347740 seconds for 1000000 iterations Refactor improved execution time by 76 percent.
Output for 7.1.4
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.794173 seconds for 1000000 iterations wp_is_stream2() => 0.385931 seconds for 1000000 iterations Refactor improved execution time by 78 percent.
Output for 7.1.2
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.662366 seconds for 1000000 iterations wp_is_stream2() => 0.389177 seconds for 1000000 iterations Refactor improved execution time by 76 percent.
Output for 7.1.1
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.949415 seconds for 1000000 iterations wp_is_stream2() => 0.456718 seconds for 1000000 iterations Refactor improved execution time by 76 percent.
Output for 7.1.0
Testing: test - wp_is_stream() => false - wp_is_stream2() => false php://test - wp_is_stream() => true - wp_is_stream2() => true http://test - wp_is_stream() => true - wp_is_stream2() => true unknown://test - wp_is_stream() => false - wp_is_stream2() => false :// - wp_is_stream() => false - wp_is_stream2() => false unknown://php://test - wp_is_stream() => false - wp_is_stream2() => false Benchmarking: wp_is_stream() => 1.775423 seconds for 1000000 iterations wp_is_stream2() => 0.345515 seconds for 1000000 iterations Refactor improved execution time by 80 percent.

preferences:
57.99 ms | 479 KiB | 5 Q