مقدار آرگومان پیش فرض PHP(PHP Default Argument Value)
مثال زیر نحوه استفاده از یک پارامتر پیش فرض را نشان می دهد. اگر تماس بگیریم
تابع setHeight() بدون آرگومان مقدار پیش فرض را به عنوان آرگومان می گیرد:
مثال
<?php declare(strict_types=1); // strict requirement
function setHeight(int $minheight = 50) {
echo "The height is : $minheight <br>";
}
setHeight(350);
setHeight(); // will use the default value of 50
setHeight(135);
setHeight(80);
?>