How to determine page URL for if/else

General discussions related to php

Moderators: macek, egami, gesf

Post Reply
Emy
New php-forum User
New php-forum User
Posts: 16
Joined: Sat Jun 02, 2012 8:16 pm

Re: How to determine page URL for if/else

Post by Emy » Tue Jun 05, 2012 5:58 pm

use preg_match or in_array

Emy
New php-forum User
New php-forum User
Posts: 16
Joined: Sat Jun 02, 2012 8:16 pm

Re: How to determine page URL for if/else

Post by Emy » Wed Jun 06, 2012 8:21 pm

You can even do like this:

Code: Select all

$myArray = array('homework-help', 'AnotherOne', 'YouCanAddMore');

$searchWord = 'homework-help';

if(in_array($searchWord, $myArray)
{
echo 'Done';
}
else
{
echo 'Try Later';
}

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest