<?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 ""
}
?>
- Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.35
- Parse error: syntax error, unexpected '}', expecting ',' or ';' in /in/40D8F on line 91
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected '}', expecting ',' or ';' in /in/40D8F on line 91
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error, expecting `','' or `';'' in /in/40D8F on line 91
Process exited with code 255.
preferences:
243.28 ms | 1395 KiB | 125 Q