Skip to main content
April 5, 2010
Answered

convert eregi to php 5.3 compliance

  • April 5, 2010
  • 2 replies
  • 763 views

ereg / eregi is no longer supported in 5.3+

need some help converting this.

<?php

$path = $_SERVER['REQUEST_URI'];

if(eregi('^/community/',$path) == 1) {

?>

This topic has been closed for replies.
Correct answer David_Powers

jsteinmann wrote:

ereg / eregi is no longer supported in 5.3+

No, it's deprecated, which means it still works, but will be removed from the next major version.

if(eregi('^/community/',$path) == 1) {

if (preg_match('#^/community/#i', $path)) {

2 replies

David_Powers
David_PowersCorrect answer
Inspiring
April 7, 2010

jsteinmann wrote:

ereg / eregi is no longer supported in 5.3+

No, it's deprecated, which means it still works, but will be removed from the next major version.

if(eregi('^/community/',$path) == 1) {

if (preg_match('#^/community/#i', $path)) {

Participating Frequently
April 5, 2010

Have you tried preg_match with the i modifier ?

HTH

-Rob B