3v4l.org

run code in 500+ PHP versions simultaneously
<?php function toLoggableText($value): string { if (null === $value || \is_scalar($value)) { dump('ici'); return (string) $value; } return print_r($value, true); } var_dump(toLoggableText(array("hemoglobin", "cytochrome c oxidase", "ferredoxin")));
Output for 8.2.0 - 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
string(86) "Array ( [0] => hemoglobin [1] => cytochrome c oxidase [2] => ferredoxin ) "

preferences:
30.12 ms | 1161 KiB | 7 Q