Solved

Synaxt on if/or statement

Posted on 2014-11-05
3
74 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 108

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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.

930 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now