print returns a value, echo doesn't. http://php.net/manual/en/function.echo.php http://www.php.net/manual/en/function.print.php
There is a slight difference between print and echo which would depend on how you want to use the outcome. Using the print method can return a true/false value. This may be helpful during a script execution of somesort. Echo does not return a value, but has been considered as a faster executed command.
Why are you saying "print does not return true or false" ? Please try. <?php $var = print "Hello"; echo "<br>"; echo $var; ?>
http://www.php.net/manual/en/function.print.php "Returns 1, always." a return value of 1 is not "true" and neither does it return false.
Thats a funny answer, in php TRUE is 1 but you just misunderstood that it will return the string "true", but am saying about true and false which are booleans. If you still have doubt please refer the page http://php.net/manual/en/language.types.boolean.php or see the out put of the code <?php echo true; ?>
Again, incorrect. (int) 1 is NOT the same as (boolean) true. <?php $int = 1; $bool = TRUE; if($int === $bool) print "they match\n"; else print "they do not match\n"; ?> PHP: OUTPUT: they do not match
Sorry, I don't think you can only understand in that way. I think you are only trying to see holes in a dougnut, as the topic is one and you are saying something. Who is saying that integer 1 is same as true in both data type and value. Almost everyone knows they are of two types but of same value. if you want to check they are of same value please try <?php $int = 1; $bool = TRUE; if($int == $bool) print "they match\n"; else print "they do not match\n"; ?> if we are using the return value of print, I don't think it will return (int) 1 and (boolean) TRUE in different cases just true or false thats it. Then what do you think print will return if you think it will neither return true or false as in http://forums.digitalpoint.com/showthread.php?t=1836834&p=14391629#post14391629.
Oops! print and echo are same like <b> and <strong> But echo is much faster than print [Google as PHP Echo Vs Print to know more ]
There is a slight difference between print and echo which would depend on how you want to use the outcome. Using the print method can return a true/false value. This may be helpful during a script execution of somesort. Echo does not return a value, but has been considered as a faster executed command. All this can get into a rather complicated discussion, so for now, you can just use whichever one you prefer.
Right thats what i am talking about! Print can be used at particular places but using echo you can do that same printing job(In Browser)