3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bar = array(); for($j = 0;$j < 100; $j++) { $bar[] = $j; } $bar['k'] = 0; // Only run if array_is_list() isn't available. if ( ! function_exists( 'array_is_list' ) ) { function array_is_list( $arr ) { if ( ( array() === $arr ) || ( array_values( $arr ) === $arr ) ) { return true; } $i = 0; foreach ( $arr as $k => $v ) { if ( $k !== $i++ ) { return false; } } return true; } for ( $z = 0; $z < 100; ++$z ) { array_is_list( $bar ); } }

preferences:
28.59 ms | 406 KiB | 5 Q