3v4l.org

run code in 300+ PHP versions simultaneously
<?php $checksum = crc32("The quick brown fox jumped over the lazy dog."); $outstring = ''; $l = strlen($data); for ($i = 0; $i < $l; $i += 8) { $chunk = substr($data, $i, 8); $outlen = ceil((strlen($chunk) * 8)/6); //8bit/char in, 6bits/char out, round up $x = bin2hex($chunk); //gmp won't convert from binary, so go via hex $w = gmp_strval(gmp_init(ltrim($x, '0'), 16), 62); //gmp doesn't like leading 0s $pad = str_pad($w, $outlen, '0', STR_PAD_LEFT); $outstring .= $pad; } echo $outstring; printf("%u\n", $checksum);
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Warning: Undefined variable $data in /in/CoY5T on line 6 Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/CoY5T on line 6 2191738434
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $data in /in/CoY5T on line 6 2191738434
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Notice: Undefined variable: data in /in/CoY5T on line 6 2191738434
Output for 7.3.32 - 7.3.33, 7.4.26
2191738434

preferences:
152.87 ms | 402 KiB | 219 Q