?
Solved

Synaxt on if/or statement

Posted on 2014-11-05
3
Medium Priority
?
80 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 2000 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 111

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

777 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