PHP8 Named arguments




// PHP 7
htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);

// PHP 8
// Specify only required parameters, skipping optional ones.
// Arguments are order-independent and self-documented.
htmlspecialchars($string, double_encode: false);

That’s it!. Please share your thoughts or suggestions in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *