Solved

using arrays

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

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

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…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

839 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