ignace Posted October 20, 2008 Share Posted October 20, 2008 Can someone tell me how the following works and how it is called (i can't find anything on the internet, and keywords like and and or display to many results logically): mysql_query("..") or exit(".."); is this also possible using ||? and how does this differ from: someFunction() and someFunction2(); again is this also possible using &&? Do just standard boolean rules apply here, like when used in an if-statement? second question how does set_include_path() work if i output the include_path before setting it it is preceded with a . (dot) which refers to the current working directory (cwd), but when i do: set_include_path("my/common/directory"); require_once "cwdfile.php"; and the file cwdfile is included because it makes sense, it first checks if the file is available in the cwd and includes it, if its not then it utilizes the include_path so why is by default the include_path preceded with a . (dot) it doesn't make sense to check if a file is in the cwd twice, does it? best regards, ignace Quote Link to comment https://forums.phpfreaks.com/topic/129263-questions-concerning-logic-operators-and-include_path/ Share on other sites More sharing options...
philipolson Posted October 20, 2008 Share Posted October 20, 2008 It's logic. foo() OR bar(); If foo() evaluates to false here then bar() will execute otherwise it will not. Read the following and do some tests too: http://php.net/manual/en/language.operators.logical.php And I prefer an if statement here, and not 'or' because it allows for a { block } to execute more than one statement. As for include_path, not sure, I was not aware of this behavior and always make sure '.' is in the include_path when wanting to include files from the cwd. I think that's a wise choice. Quote Link to comment https://forums.phpfreaks.com/topic/129263-questions-concerning-logic-operators-and-include_path/#findComment-670182 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.