เมื่อเราเรียกใช้ฟังก์ชัน แต่เราส่งพารามิเตอร์ไม่ครบตามจำนวนที่ฟังก์ชันนั้น ๆ ระบุไว้ PHPจะทำการตรวจสอบและแจ้งเตือนกลับมาให้เราทราบว่าเราส่งพารามิเตอร์ไม่ครบ ดังนี้
<?php
function takes_two($a, $b) {
if (isset($a)) { echo " a is set\n"; }
if (isset($b)) { echo " b is set\n"; }
}
echo "With two arguments:\n";
takes_two(1, 2);
echo "With one argument:\n";
takes_two(1);
?>
# ผลลัพธ์ With two arguments: a is set b is set With one argument: Warning: Missing argument 2 for takes_two() in .... on line 6 a is set
ผู้สนับสนุน