3v4l.org

run code in 500+ PHP versions simultaneously
<?php function calculateTotal(string $item, float $price, int $quantity = 1): string { $subtotal = $price * $quantity; return "$quantityx $item = $$subtotal"; } // Call the function and print the result echo calculateTotal($item, $price, $quantity);
Output for git.master_jit, git.master
Warning: Undefined variable $item in /in/lP681 on line 10 Warning: Undefined variable $price in /in/lP681 on line 10 Warning: Undefined variable $quantity in /in/lP681 on line 10 Fatal error: Uncaught TypeError: calculateTotal(): Argument #1 ($item) must be of type string, null given, called in /in/lP681 on line 10 and defined in /in/lP681:3 Stack trace: #0 /in/lP681(10): calculateTotal(NULL, NULL, NULL) #1 {main} thrown in /in/lP681 on line 3
Process exited with code 255.

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:
49.57 ms | 727 KiB | 4 Q