Solved

Synaxt on if/or statement

Posted on 2014-11-05
3
78 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 110

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

734 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