Rabu, 31 Maret 2010

Error yg kualami di XAMPP

Offline louis_coetzeeTopic starter

  • Enthusiast

    • View Profile
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

Code: [Select]
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;
   }
?>


Offline TeNDoLLA

  • Enthusiast

    • View Profile
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.

Code: [Select]
<?php
if (preg_match('/.jpg/i'$file))
« Last Edit: September 08, 2009, 01:14:06 PM by TeNDoLLA »

Offline louis_coetzeeTopic starter

  • Enthusiast

    • View Profile
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.

Code: [Select]
<?php
if (preg_match('/.jpg/i'$file))

Thanks a lot. Solved!

Tidak ada komentar:

Posting Komentar