3v4l.org

run code in 500+ PHP versions simultaneously
<?php function cmp_strict(mixed $a, mixed $b): int { if ($a === $b) return 0; $typeA = gettype($a); $typeB = gettype($b); if ($typeA === $typeB) { // abstract function to compare values without type juggling return cmp_values_strict($a, $b); } else { return $typeA <=> $typeB; } } var_dump(cmp_strict(0, '0'));
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
int(-1)

preferences:
29.36 ms | 1152 KiB | 7 Q