mercredi 25 février 2015

Using IF with curly brackets within IF without

I have some code where i'm trying to use the different ifs within each other, but i ran into a problem.. I've made this testcode that will show the issue:



<?php
$test = 'lol';
if ($test == 'wat') :
if (!empty($_GET['wat'])) {
echo 'well';
}
elseif ($test == 'lol') :
echo 'loool';
endif;
die();
?>


This will return this error:


Parse error: syntax error, unexpected ':' in /var/www/http://ift.tt/1DpmD3Q on line 7


But that's only after i'm adding the if (!empty($_GET['wat'])) { }


The question is, am i doing something wrong, or isn't it possible to use a if with curly brackets within one without ?


Aucun commentaire:

Enregistrer un commentaire