<?php
$a=true ;
$b=1;
// Below condition returns true and prints a and b are equal
if($a==$b){
echo "a and b are equal";
}
else{
echo "a and b are not equal";
}
//Below condition returns false and prints a and b are not equal because $a and $b are of different data types.
if($a===$b){
echo "a and b are equal";
}
else{
echo "a and b are not equal";
}
?>
``echo str_replace("World","Peter","Hello world!");
output: Hello Peter!
This function are case-insensitive
echo str_ireplace("WORLD","Peter","Hello good world!");
output: Hello good Peter!
Echo
echo is a statement, which is used to display the output.
echo can be used with or without parentheses.
echo does not return any value.
We can pass multiple strings separated by comma (,) in echo.
echo is faster than print statement.
Print
print is also a statement, used as an alternative to echo at many times to display the output.
print can be used with or without parentheses.
print always returns an integer value, which is 1.
Using print, we cannot pass multiple arguments.
print is slower than echo statement.