paragkalra Posted January 24, 2009 Share Posted January 24, 2009 I have following logic in one of my php file: if($var) echo ""; else die("Not defined"); It's working but the problem is that echo in "if" clause is inducing a new line. Does anyone know any dummy php function or a command which will do nothing and will also not insert a new line? Or is there a way through which I can disable new line using "echo" itself? Link to comment https://forums.phpfreaks.com/topic/142227-solved-dummy-php-function-or-a-dummny-command/ Share on other sites More sharing options...
Philip Posted January 24, 2009 Share Posted January 24, 2009 you could always do something like usleep(1), which would "pause" execution for 1ms. That's about the most 'dummy' like function I can think of (maybe like $i = 1, or something like that) Link to comment https://forums.phpfreaks.com/topic/142227-solved-dummy-php-function-or-a-dummny-command/#findComment-745134 Share on other sites More sharing options...
.josh Posted January 24, 2009 Share Posted January 24, 2009 if you don't want the if condition to do anything if it's true, then just don't use it. if (!$var) die("Not Defined"); or if you insist on having it but doing nothing, put nothing in it: if ($var) { // I do nothing, what's the point in living?? } else { die("Not Defined"); } Link to comment https://forums.phpfreaks.com/topic/142227-solved-dummy-php-function-or-a-dummny-command/#findComment-745136 Share on other sites More sharing options...
paragkalra Posted January 24, 2009 Author Share Posted January 24, 2009 Thanks KingPhilip & Crayon Violent for your suggestions ... as a workaround I am already using: if(!$var) die("Not defined"); Link to comment https://forums.phpfreaks.com/topic/142227-solved-dummy-php-function-or-a-dummny-command/#findComment-745141 Share on other sites More sharing options...
.josh Posted January 24, 2009 Share Posted January 24, 2009 It's not really a workaround if it's how you are supposed to do it... Link to comment https://forums.phpfreaks.com/topic/142227-solved-dummy-php-function-or-a-dummny-command/#findComment-745252 Share on other sites More sharing options...
paragkalra Posted January 24, 2009 Author Share Posted January 24, 2009 @ Crayon Violent Yup U are correct...my aim was just to know if there is any dummy function or a command available in php... Link to comment https://forums.phpfreaks.com/topic/142227-solved-dummy-php-function-or-a-dummny-command/#findComment-745258 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.