How to determine page URL for if/else

General discussions related to php

Moderators: egami, macek, gesf

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

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

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
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests