3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $set1 = ['A', 'B', 'C']; $set2 = [1, 2, 3]; function perms( $set1, $set2, $i) { $perms = array(); if( $i == size( $set1) - 1) { return array(); } foreach( $set1 as $1) { foreach( $set2 as $2) { $perms[] = $1 . $2; } } $i++; for( $j = 0; $j < $i; $j++) { $set1[] = array_shift( $set1); $set2[] = array_shift( $set2); } return array_merge( $perms, perms( $set1, $set2)); } var_dump( perms( $set1, $set2, 0));
Output for 5.4.0 - 5.4.22
Parse error: syntax error, unexpected '1' (T_LNUMBER), expecting variable (T_VARIABLE) or '$' in /in/Rl0DP on line 12
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected '[' in /in/Rl0DP on line 2
Process exited with code 255.