3v4l.org

run code in 300+ PHP versions simultaneously
<?php ////////////////////////////////////////////////////////////////// // // This is not a difficult test, but it will test your ability to // read and write code as it might exist within our application. // // This should take less than 30 minutes. // // Good luck! // ////////////////////////////////////////////////////////////////// // Part One: Reading ////////////////////////////// // Your challenge here is to figure out what this code does. // Please change the variable names to something more appropriate, // and also comment it to the best of your ability. $s = 'typewriter'; $t = array( ); $a = str_split( $s ); $o = array( ); $o['a'] = array( 'q', 'w', 'z', 'x' ); $o['b'] = array( 'v', 'f', 'g', 'h', 'n' ); $o['c'] = array( 'x', 's', 'd', 'f', 'v' ); $o['d'] = array( 'x', 's', 'w', 'e', 'r', 'f', 'v', 'c' ); $o['e'] = array( 'w', 's', 'd', 'f', 'r' ); $o['f'] = array( 'c', 'd', 'e', 'r', 't', 'g', 'b', 'v' ); $o['g'] = array( 'r', 'f', 'v', 't', 'b', 'y', 'h', 'n' ); $o['h'] = array( 'b', 'g', 't', 'y', 'u', 'j', 'm', 'n' ); $o['i'] = array( 'u', 'j', 'k', 'l', 'o' ); $o['j'] = array( 'n', 'h', 'y', 'u', 'i', 'k', 'm' ); $o['k'] = array( 'u', 'j', 'm', 'l', 'o' ); $o['l'] = array( 'p', 'o', 'i', 'k', 'm' ); $o['m'] = array( 'n', 'h', 'j', 'k', 'l' ); $o['n'] = array( 'b', 'g', 'h', 'j', 'm' ); $o['o'] = array( 'i', 'k', 'l', 'p' ); $o['p'] = array( 'o', 'l' ); $o['r'] = array( 'e', 'd', 'f', 'g', 't' ); $o['s'] = array( 'q', 'w', 'e', 'z', 'x', 'c' ); $o['t'] = array( 'r', 'f', 'g', 'h', 'y' ); $o['u'] = array( 'y', 'h', 'j', 'k', 'i' ); $o['v'] = array( '', 'c', 'd', 'f', 'g', 'b' ); $o['w'] = array( 'q', 'a', 's', 'd', 'e' ); $o['x'] = array( 'z', 'a', 's', 'd', 'c' ); $o['y'] = array( 't', 'g', 'h', 'j', 'u' ); $o['z'] = array( 'x', 's', 'a' ); $o['1'] = array( 'q', 'w' ); $o['2'] = array( 'q', 'w', 'e' ); $o['3'] = array( 'w', 'e', 'r' ); $o['4'] = array( 'e', 'r', 't' ); $o['5'] = array( 'r', 't', 'y' ); $o['6'] = array( 't', 'y', 'u' ); $o['7'] = array( 'y', 'u', 'i' ); $o['8'] = array( 'u', 'i', 'o' ); $o['9'] = array( 'i', 'o', 'p' ); $o['0'] = array( 'o', 'p' ); foreach( $a as $key => $value ) { $u = $a; echo "Key: $key, value $value"; } foreach( $a as $key => $value ) { $u = $a; foreach( $o[$value] as $p ) { $u[$key] = $p; $t[] = join( "", $u ); } } print_r( $t ); foreach( $a as $key => $value ) { $u = $a; echo "" } ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.350.0040.03512.06
5.4.340.0030.03712.05
5.4.320.0070.03512.55
5.4.310.0040.04312.55
5.4.300.0040.03912.55
5.4.290.0080.03612.54
5.4.280.0070.03412.44
5.4.270.0050.03812.44
5.4.260.0070.03712.44
5.4.250.0030.04012.44
5.4.240.0050.03712.44
5.4.230.0070.03712.43
5.4.220.0030.03912.43
5.4.210.0090.03112.43
5.4.200.0030.03912.43
5.4.190.0040.03812.43
5.4.180.0080.03312.43
5.4.170.0070.03512.43
5.4.160.0080.03412.43
5.4.150.0020.04012.43
5.4.140.0060.03712.12
5.4.130.0040.03712.10
5.4.120.0060.03412.07
5.4.110.0040.03712.06
5.4.100.0070.03412.06
5.4.90.0050.03812.06
5.4.80.0050.04112.06
5.4.70.0040.03612.05
5.4.60.0030.03912.05
5.4.50.0050.03712.05
5.4.40.0070.03312.04
5.4.30.0020.04012.04
5.4.20.0050.03512.04
5.4.10.0090.03212.05
5.4.00.0030.03911.54
5.3.290.0030.04212.80
5.3.280.0060.03712.71
5.3.270.0050.04012.73
5.3.260.0040.04112.72
5.3.250.0080.03512.72
5.3.240.0060.03712.72
5.3.230.0060.03912.71
5.3.220.0040.03812.68
5.3.210.0040.04012.68
5.3.200.0030.03912.68
5.3.190.0070.03912.68
5.3.180.0050.03712.67
5.3.170.0050.03812.67
5.3.160.0020.03912.67
5.3.150.0040.03912.67
5.3.140.0050.03712.66
5.3.130.0050.04112.66
5.3.120.0050.04012.66
5.3.110.0090.03612.66
5.3.100.0060.03712.12
5.3.90.0090.03412.10
5.3.80.0070.03612.09
5.3.70.0080.03512.10
5.3.60.0050.03812.08
5.3.50.0100.04112.02
5.3.40.0090.04212.03
5.3.30.0080.03211.99
5.3.20.0050.03611.76
5.3.10.0070.03311.73
5.3.00.0060.03511.72
5.2.170.0050.0309.23
5.2.160.0020.0329.23
5.2.150.0020.0339.23
5.2.140.0080.0279.22
5.2.130.0050.0299.18
5.2.120.0050.0289.18
5.2.110.0050.0309.19
5.2.100.0030.0319.19
5.2.90.0050.0299.19
5.2.80.0060.0299.18
5.2.70.0040.0319.18
5.2.60.0030.0319.13
5.2.50.0080.0269.10
5.2.40.0070.0299.09
5.2.30.0060.0429.06
5.2.20.0060.0389.05
5.2.10.0060.0298.97
5.2.00.0050.0288.83
5.1.60.0010.0278.13
5.1.50.0040.0258.14
5.1.40.0030.0258.12
5.1.30.0030.0278.47
5.1.20.0040.0268.49
5.1.10.0040.0268.21
5.1.00.0020.0278.21
5.0.50.0030.0216.70
5.0.40.0050.0176.55
5.0.30.0060.0286.37
5.0.20.0020.0206.34
5.0.10.0020.0216.31
5.0.00.0030.0316.30
4.4.90.0010.0174.78
4.4.80.0020.0154.75
4.4.70.0010.0174.75
4.4.60.0030.0154.76
4.4.50.0030.0144.77
4.4.40.0080.0204.71
4.4.30.0040.0144.76
4.4.20.0070.0114.85
4.4.10.0020.0174.85
4.4.00.0050.0234.76
4.3.110.0010.0174.67
4.3.100.0010.0174.66
4.3.90.0030.0144.63
4.3.80.0040.0234.60
4.3.70.0020.0154.63
4.3.60.0020.0144.63
4.3.50.0010.0174.63
4.3.40.0030.0244.56
4.3.30.0010.0173.37
4.3.20.0020.0163.34
4.3.10.0000.0173.30
4.3.00.0100.0206.76

preferences:
143.43 ms | 1394 KiB | 7 Q