3v4l.org

run code in 300+ PHP versions simultaneously
<?php $layout = '+2-1+18*+7-21+3*-4-5+6x29'; sscanf( $layout, '%[-+x]%d%[-+x]%d%[-+x]%d*%[-+x]%d%[-+x]%d%[-+x]%d*%[-+x]%d%[-+x]%d%[-+x]%d', $column1[0][0], $column1[0][1], $column1[1][0], $column1[1][1], $column1[2][0], $column1[2][1], $column2[0][0], $column2[0][1], $column2[1][0], $column2[1][1], $column2[2][0], $column2[2][1], $column3[0][0], $column3[0][1], $column3[1][0], $column3[1][1], $column3[2][0], $column3[2][1] ); var_export($column1); echo "\n---\n"; var_export($column2); echo "\n---\n"; var_export($column3); /*foreach (explode('*', $layout) as $i => $column) { printf( "%d: %s\n", $i + 1, var_export( preg_match_all('~(\D)(\d+)~', $column, $matches) ? array_map(null, $matches[1], $matches[2]) : [], true ) ); }*/
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.4, 8.3.6 - 8.3.25, 8.4.1 - 8.4.12
array ( 0 => array ( 0 => '+', 1 => 2, ), 1 => array ( 0 => '-', 1 => 1, ), 2 => array ( 0 => '+', 1 => 18, ), ) --- array ( 0 => array ( 0 => '+', 1 => 7, ), 1 => array ( 0 => '-', 1 => 21, ), 2 => array ( 0 => '+', 1 => 3, ), ) --- array ( 0 => array ( 0 => '-', 1 => 4, ), 1 => array ( 0 => '-', 1 => 5, ), 2 => array ( 0 => '+', 1 => 6, ), )
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 array ( 0 => array ( 0 => '+', 1 => 2, ), 1 => array ( 0 => '-', 1 => 1, ), 2 => array ( 0 => '+', 1 => 18, ), ) --- array ( 0 => array ( 0 => '+', 1 => 7, ), 1 => array ( 0 => '-', 1 => 21, ), 2 => array ( 0 => '+', 1 => 3, ), ) --- array ( 0 => array ( 0 => '-', 1 => 4, ), 1 => array ( 0 => '-', 1 => 5, ), 2 => array ( 0 => '+', 1 => 6, ), )

preferences:
131.93 ms | 409 KiB | 5 Q