=, ==, === PHP Operators

609

 2,968 total views

PHPல் =, == & === செயலிகள்.

$a = 10;  // 10 என்ற மதிப்பு $a . சேமிக்கப்படுகிறது.

if($a==$b)

== என்பது, மாறிகளின்(variables) மதிப்புகள்(values) சமமாக உள்ளதா என்று மட்டும் சோதிக்கும்.

if($a===$b)

===  என்பது, மாறிகளின்(variables) மதிப்புகள்(values) மற்றும் வகை(Type) இரண்டும் சரியாக உள்ளதா என சோதிக்கும்.

பின்வரும் இரண்டு சோதனைகளைச் செய்யவும்.

<?php

$a=10;

$b = “10”;

if($a==$b)

echo “Both Are Same”;

?>

<?php

$a=10;

$b = “10”;

if($a===$b)

echo “Both Are Same”;

else

echo “a is 10, b is 10. But a is integer 10 & b is string ’10′”;

?>

You might also like

Comments are closed.