Jump to content

[SOLVED] Deprecated: Function eregi() is deprecated in C:\wamp\www\age_art\new\models\pro


louis_coetzee

Recommended Posts

Hi, I had to re-install my wampserver, probably a new version, now I get this new error:

Deprecated: Function eregi() is deprecated in C:\wamp\www\age_art\new\models\products.php on line 8

 

This is: products.php

<?php
function image_list($image_dir)
{
	$fileCount = 1; 
	$dir = opendir($image_dir);
	while ($file = readdir($dir)) 
	{ 
  			if (eregi("\.jpg",$file)) 
		{
    			$image_array[$fileCount] = $file;
    			$fileCount++;
  			}
	}
	return $image_array;
}
?>

Link to comment
Share on other sites

It means the function is old and not supposed to use anymore. I don't remember the versions where this still was or where it was removed but thats probably the case. You should use preg_match. And instead of all ereg* functions there is usually preg_* function that you can use. You can use the i -modifier to get it work incase sensitive.

 

<?php
if (preg_match('/.jpg/i', $file))

Link to comment
Share on other sites

It means the function is old and not supposed to use anymore. I don't remember the versions where this still was or where it was removed but thats probably the case. You should use preg_match. And instead of all ereg* functions there is usually preg_* function that you can use. You can use the i -modifier to get it work incase sensitive.

 

<?php
if (preg_match('/.jpg/i', $file))

Thanks a lot. Solved!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.