Solved

using arrays

Posted on 2006-11-26
2
210 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

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

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.

920 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

15 Experts available now in Live!

Get 1:1 Help Now