Searching an expression using regular expressions.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jak82
Forum Newbie
Posts: 11
Joined: Mon Oct 15, 2007 4:21 am

Searching an expression using regular expressions.

Post by jak82 »

Hey there,

I am trying to find the element of an array which has .php in

Code: Select all

$chars =split("/", $_SERVER['PHP_SELF'], 5);
$cj = in_array(".php", $chars);

print_r($chars);
echo $cj;
The problem is $cj = nothing. Im guessing this is because it looks for an exact match.
How can I use regular expressions to search for the element with anything .php .

Chris
jak82
Forum Newbie
Posts: 11
Joined: Mon Oct 15, 2007 4:21 am

doesnt matter

Post by jak82 »

Foudn anothe rfunction which dioes it for you..

Basename

J
Post Reply