Solved

using arrays

Posted on 2006-11-26
2
218 Views
Last Modified: 2009-12-16
At this time my  code looks like :
if ( $page!="status" || $page!="downed" || $page!="admin" || $page!="news" || $page!="forum" )

Is there any way i can do this using an array so I don't have to write checks for every page.
0
Comment
Question by:brightwood
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 18015356
$pages = array("status", "downed", "admin", "news", "forum");

if (in_array($page, $pages))
{
  // item is in the list
}
else
{
  // item is not in the list
}

http://php.net/manual/de/function.in-array.php
0
 

Author Comment

by:brightwood
ID: 18015510
thank you
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

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 …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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…

778 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