Topic: Easy to make mistake
hellow…I am trying to post a very simple Example of php variabe assigning..Its easy to make mistake when we assign values.Run the php code:
<?php
$a=0;
$b;
if ($a==$b) print(”values are same<br>”);
else print(”Variables are different<br>”);
?>output: values are same.
It means the value of $b is 0.
yaa….thats right.when we declare a php variabe Its initial value is 0 in number format.In strig format it is an empty string…its different in C++.
Just try to edit the code like folowing:
<?php
$a;
$b;
if ($a==$b) print(”values are same<br>”);
else print(”Variables are different<br>”);
?>output is same coz both of these variables values are empty string or NULL..
we can print the value of $b.
printf(”%f”,$b); //result is 0.0000…//
so be aware of using these types of variable assignment……..I think It will help you…..:)