3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php public static function encode($product, $user) { $ch = str_split('abcdefghijkmnpqrstuvwxyz23456789'); if ($product < 0 || $user < 0) { return; } $lower4 = $user << 3; $lower4Bits = floor(log($lower4, 2))+1; $lower4 |= ceil($lower4Bits / 5); $str = ''; do { $str = $ch[$lower4 & 31] . $str; } while($lower4 >>= 5); $upper4 = $product; do { $str = $ch[$upper4 & 31] . $str; } while($upper4 >>= 5); return $str; } $u = "44390"; $p = "77780"; println(encode($p,$u));
based on F1PsZ
Output for 5.4.0 - 5.4.35
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/psQHv on line 4
Process exited with code 255.
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_PUBLIC in /in/psQHv on line 4
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_PUBLIC in /in/psQHv on line 4
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STATIC in /in/psQHv on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STATIC in /in/psQHv on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/psQHv on line 4
Process exited with code 255.