Entry
Why "(file_exists("filename.ext")) ? echo "text1" : echo "text2";" doesn't work ? Works with print...
Feb 3rd, 2001 00:23
Philip Olson, Luc Abélard,
Ideally, this should be done like this :
<?php
echo (file_exists('filename.ext')) ? 'text1' : 'text2';
?>
No reason to use two echos or prints. Have a look here :
What is the difference between echo and print ?
-----------------------------------------------------------
http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40
Print is a function, echo is an expression. Another faqt that deals
with this question is here :
Can I use echo inside a ternary expression ?
-----------------------------------------------------------
http://www.faqts.com/knowledge_base/view.phtml/aid/5/fid/41