3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = array( 'empty array' => array(), 'consecutive from 0' => array( 0 => 'one', 1 => 'two', ), 'consecutive from 0 float' => array( 0.0 => 'one', 1.0 => 'two', ), 'consecutive from 0 str' => array( '0' => 'one', '1' => 'two', ), 'consecutive from 1' => array( 1 => 'one', 2 => 'two', ), 'consecutive from 1 float' => array( 1.0 => 'one', 2.0 => 'two', ), 'consecutive from 1 str' => array( '1' => 'one', '2' => 'two', ), 'non-consecutive int' => array( 1 => 'one', 0 => 'two', ), 'non-consecutive float' => array( 1.0 => 'one', 0.0 => 'two', ), 'non-consecutive string' => array( '1' => 'one', '0' => 'two', ), ); foreach ( $tests as $test => $arr ) { echo str_pad( $test, 30 ), var_export( array_is_list( $arr ), true ), PHP_EOL; }

preferences:
51.36 ms | 406 KiB | 5 Q