3v4l.org

run code in 300+ PHP versions simultaneously
<?php $key = "66b3b0d86b56dfca4c8ca3e883700ac6"; $key = str2hex_array($key); print_r($key); function str2hex_array($str){ $str_arr = str_split(strToUpper($str), 2); //$str_hex = array(); $str_hex = ""; for ($i=0; $i < count($str_arr); $i++){ $ord1 = ord($str_arr[$i][0])-48; $ord2 = ord($str_arr[$i][1])-48; if ($ord1 > 16) $ord1 = $ord1 - 7; if ($ord2 > 16) $ord2 = $ord2 - 7; $str_hex[$i] = $ord1 * 16 + $ord2; } return $str_hex; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 Warning: Only the first byte will be assigned to the string offset in /in/YoHIc on line 15 1112182271121111
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
1112182271121111

preferences:
148.12 ms | 409 KiB | 5 Q