3v4l.org

run code in 300+ PHP versions simultaneously
<?php function amountType(string $amount): string { if (is_numeric($amount)) { if ((int) $amount == (float) $amount) { return "int"; } return "float"; } return "string"; } $amount1 = "99.9"; $amount2 = "99"; $amount3 = "NinetyNine"; echo $amount1 . ": " . amountType($amount1) . PHP_EOL; echo $amount2 . ": " . amountType($amount2) . PHP_EOL; echo $amount3 . ": " . amountType($amount3) . PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
99.9: float 99: int NinetyNine: string

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
157.65 ms | 405 KiB | 5 Q