php short code

$s = is set to 'i'
but if 'i' is not set..
then..
$s = is set to 1.

$s=isset($_GET['i'])?$_GET['i']:1;

if I can not memorize the code above..

I will do ..

$is = isset($_GET['i']);
if($is){$s=$_GET['i'];}else{$s=1;}

I think it is possible to remove the brackets..

$is = isset($_GET['i']);
if($is) $s=$_GET['i']; else $s=1;

to make it shorter I will remove 1 character from "$is"

let's call it 'q' so that 'q' can stand for 'question'

$q = isset($_GET['i']);
if($q) $s=$_GET['i']; else $s=1;

if the question gets a valid answer
then set $s to the value of $_GET['i'];

otherwise set $s=1;








Report A Problem