สอนเขียนภาษา PHP สร้างฟังก์ชันแบบไม่คืนค่า และแบบคืนค่า โดยจะสร้างฟังก์ชันแบบไม่คืนค่าชื่อ helloNoReturn และแบบคืนค่าชื่อ helloWithReturn สามารถเขียนโปรแกรมได้ดังนี้
ตัวอย่าง PHP ฟังก์ชันแบบไม่คืนค่า และแบบคืนค่า
<?php
    function helloWithReturn() {
        return "Hello with return";
    }
    function helloNoReturn() {
        echo "Hello no return";
    }
    echo helloWithReturn();
    echo "<br/>";
    helloNoReturn();
?>ผลลัพธ์
Hello with return
Hello no return