Checking if a value is set
Wed Jul 13 2022 05:48:22 GMT+0000 (UTC)
Saved by
@patdevwork
// Using ternary operator
$page = isset($_GET['page']) ? $_GET['page'] : '1' // setting the default value to '1'
or in php 7 the more shortcut way is
$page = $_GET['page'] ?? '1';
content_copyCOPY
Comments