if statement cause white screen

Hello everyone I am new to php and this forum. I am a 23 year old shop owner trying to learn PHP I have been making a script with just examples. I currently write my cgi scripts in bash but need to handle file uploads and PHP would be much better for that, but my if statements are causing the script to fail and just load a white screen.

<?php $value1 = "1"; $value2 = "1"; ?>

###################
when I remove this it works

<?php {if $value1 == $value2} echo "They are equal"; {/if} ?>

###################
heres the full script
##################

NewPHP

PHP

<?php echo date("F j, Y"); ?>
<?php $randomString = substr(md5(microtime()), 0, 5); echo $randomString ?>
<?php $one = "1"; $two = "2"; $three = "3"; echo $one, $two, $three; echo "
"; printf("onetwothree $one, $two, $three"); echo "
"; $to = sprintf("$one$two$three"); print $to; ?>
<?php $total = 5; $count = "15"; $total += $count; echo $total ?> <?php $file = '/sites/html'; sprintf(readfile($file)); //$putin = readfile($file); //echo putin; ?> <?php $value1 = "1"; $value2 = "1"; ?> <?php {if $value1 == $value2} echo "finally"; {/if} ?>

Your syntax of the PHP’s if() statement is not correct. Correct use would be:
[php]if ($value1 == $value2){
echo “They are equal”;
}[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service