PHP Programmer’s Of Bangladesh

Explain it !!!!

Posted by: Md. Masud on: May 24, 2007

I have found a code of php like that.
what is the Output of this code?

<?php

$x = 0;

echo -$x;

?>

Answer: -1

But i want to know why and how?????

with regards
masud

1 Response to "Explain it !!!!"

simple , if it was -$x the its as 0-1 = -1, so

try echo -$x + 1; will be 0

Leave a Reply

Where I was???

I was a PHP/MySQL web application developer in EVOKNOW INC from 1st July, 2006 to 5th Nov, 2007.

Blog Stats

  • 27,587 hits

What is the date?????

May 2007
S S M T W T F
« Apr   Jun »
 1234
567891011
12131415161718
19202122232425
262728293031  

My Links in Del.icio.us

Google Adds