Solved

Synaxt on if/or statement

Posted on 2014-11-05
3
77 Views
Last Modified: 2014-11-06
What is the correct way to write this statement:
if ($_SESSION['Last_Page'] == "Space_Display.php"
 or $_SESSION['Last_Page'] == "Space_Edit.php")

I've seen several examples with different syntax.
0
Comment
Question by:breeze351
3 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40424922
You can also use '||' in place of 'OR' (or 'or').   http://us1.php.net/manual/en/language.operators.logical.php
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 40425098
To paraphrase:

I want to do something if $_SESSION['Last_Page'] contains either "Space_Display.php" or "Space_Edit.php" but if $_SESSION['Last_Page'] contains neither of those strings, I want to do something else.

Is that correct?
0
 

Author Closing Comment

by:breeze351
ID: 40427044
Thanks that works.  I just wanted to make sure the syntax was what people are using.  Use the || instead of OR.
Glenn
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question