<?php
function addNumbers($a, $b) {
$sum = $a + $b;
return $sum;
}
// Calling the function and storing the result in a variable
$result = addNumbers(5, 3);
// Displaying the result
echo "The sum is: $result";
?>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter