Solved

Synaxt on if/or statement

Posted on 2014-11-05
3
72 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 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

772 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

11 Experts available now in Live!

Get 1:1 Help Now