etrader Posted May 19, 2011 Share Posted May 19, 2011 I have a series of string which can have a value or empty. I want to display them with echo. echo $string1 $string2 $string3; satisfies my need, as it shows available values, but with this method, I will get a PHP notice in my error_logs. What is your suggestion? Do I need to use "if (empty)" or "if(isset)"? The point is I have numerous strings and in each run only few of them have value. Quote Link to comment https://forums.phpfreaks.com/topic/236852-echo-a-series-of-strings-with-empty-values/ Share on other sites More sharing options...
anupamsaha Posted May 19, 2011 Share Posted May 19, 2011 Use if(isset()). Quote Link to comment https://forums.phpfreaks.com/topic/236852-echo-a-series-of-strings-with-empty-values/#findComment-1217486 Share on other sites More sharing options...
Adam Posted May 19, 2011 Share Posted May 19, 2011 Using empty will implicitly perform an isset check, as well as checking for an empty string. Quote Link to comment https://forums.phpfreaks.com/topic/236852-echo-a-series-of-strings-with-empty-values/#findComment-1217488 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.