Jump to content

True / False Evaluation Questions


timothyarden

Recommended Posts

Hi Freaks,

Just some quick questions:

 

1) Assuming the function test() returns a true or false value, would these two pieces of code process the same? (if not could you please explain why)

if(test()){
// action(s)
}

//and

if(test() === true){
//action(s)
}

 

2) Same question except for false:

if(!test()){
// action(s)
}

//and

if(test() === false){
//action(s)
}

 

3) if the function returned a string / integer / array / true on success or false on failure would the actions in the if loop execute? (assuming that the function test returned success and therefore was a string / integer / array / true):

if(test()){
// action(s)
}

 

 

Thanks for reading and for everyones help in advance. I know this kind of post would generally be responded to with go try it for yourself but my XAMPP has currently been not allowing me to turn on Apache because of an error.

 

Timothy

Link to comment
Share on other sites

You can run PHP scripts from the command-line as well --- no Apache needed.

 

Hi David,

I am coding on a Windows 8 PC. Are you sure I can run it from the command line? (I assume you mean command prompt)

 

And I thought you couldn't install PHP on Windows PC trq?

 

Thanks for the help and advice guys :)

Link to comment
Share on other sites

If you installed XAMP on Windows, then you have PHP installed on Windows. I have LAMP running on a Windows 7 machine at work -- I don't recommend Windows for this either, but that's what I have to work with there. I run PHP scripts from the command line (command prompt) all the time. I have even put a couple in the Task Scheduler.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.