-2

I've read many threads here about this being deprecated and tried replacing it with preg_match but I don't know php enough to fix the rest of the line.

Been enjoying Fotoholder for years, I would switch to a newer similar single file gallery code but then I would lose all my descriptions in the gallery.

Please help resurrect Fotopholder! ( https://github.com/offsky/Fotopholder )

Here are the 2 parts that have eregi:

 
     if(substr($entry,0,1)!="." && !preg_match("#_cache#i",$entry) && is_dir($path."/".$entry)) {
      

and the 2nd eregi:

      if(substr($entry,0,1)!="." && !eregi("_cache",$entry)) {

Thank you very much for your help.

  • Don't you just need to use the `preg_match` function like you did in the first block? – user3783243 Jul 15 '18 at 21:10
  • If you're new to PHP, just disable the deprecated warning. – Ultimater Jul 15 '18 at 21:15
  • The first conversion is already correct. Albeit for matching fixed strings `strstr()` might suffice even. – mario Jul 15 '18 at 21:20
  • Thank you @Ultimater - that did the trick. – MateoGuineo Jul 16 '18 at 04:28
  • @mario The php manual says (in one of those cute Notes) not to use `strstr()` to check the existence of a substring -- `strpos()` is the "lighter"/ better suited call. – mickmackusa Jul 18 '18 at 09:37
  • 1
    @mickmackusa It is, performance-wise of course. But `strstr` is usually more legible (without the !== decoration). Still not sure if the manual advise is really newcomer friendly. – mario Jul 18 '18 at 10:30

1 Answers1

0

Deprecated means, that the function eregi() is likely to get deleted from the language.

Please use preg_match().

While you still can use eregi(), at a certain point of time your application might not be able to execute any more.

That said: Your code posted is far to big to get a detailed answer.

SteAp
  • 11,853
  • 10
  • 53
  • 88