3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $temp = '-k'; $v='j'; $neg_t = strpos($temp,'-')?TRUE:FALSE; $neg_v = strpos($v,'-')?TRUE:FALSE; $temp = substr($temp, -1); $v = substr($v, -1); switch($temp) { case '0': $temp = $v; break; case '1': switch($v) { case '1':$temp = '1'; break; case 'i':$temp = 'i'; break; case 'j':$temp = 'j'; break; case 'k':$temp = 'k'; break; } break; case 'i': switch($v) { case '1':$temp = 'i'; break; case 'i':$temp = '-1'; break; case 'j':$temp = 'k'; break; case 'k':$temp = '-j'; break; } break; case 'j': switch($v) { case '1':$temp = 'j'; break; case 'i':$temp = '-k'; break; case 'j':$temp = '-1'; break; case 'k':$temp = 'i'; break; } break; case 'k': switch($v) { case '1':$temp = 'k'; break; case 'i':$temp = 'j'; break; case 'j':$temp = '-i'; break; case 'k':$temp = '-1'; break; } break; } if($neg_t xor $neg_v) { $temp = '-' . $temp; } if($net_t && $neg_v) $temp = substr($temp,-1); echo $temp;
based on B9fNc
Output for 5.0.4 - 7.2.0
Notice: Undefined variable: net_t in /in/KGTrE on line 56 -i
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: net_t in /in/KGTrE on line 56 -i