Skip to main content
Topic: Fatal error: Cannot redeclare str_contains() (Read 13721 times) previous topic - next topic

Re: Fatal error: Cannot redeclare str_contains()

Reply #15
hello  swisscharles you need to comments line 524 {} after it will work

Thanks ayilmaz. Everything working now!
Does anybody know about any unwanted side effects when commenting said line out?


Re: Fatal error: Cannot redeclare str_contains()

Reply #16
There is a new function in PHP 8 with the name str_contains.
here you can see https://php.watch/versions/8.0/str_contains
for this reason, it shows the error, just rename it something "my_str_contains"


Re: Fatal error: Cannot redeclare str_contains()

Reply #18
Achei essa solução nesse site:
https://www.putraritoyan.top/2021/05/source-code-aplikasi-pencatatan-surat.html
kemudian baris code pada baris 524
function str_contains($needle, $haystack)
{
   return strpos($haystack, $needle) !== false;
}

dirubah menjadi

error_reporting(0);
if (strpos($haystack, $needle) !== false) {
  echo '';
}

Re: Fatal error: Cannot redeclare str_contains()

Reply #19
function str_contains($needle, $haystack)
{
      return strpos($haystack, $needle) !== false;
}

Change this code

error_reporting(0);
if (strpos($haystack, $needle) !== false) {
  echo '';
}