Call to undefined function str_contains()

Full code works on localhost, but when i imported all files to host here i get this error message:

Fatal error: Uncaught Error: Call to undefined function str_contains() in /home/vol15_4/

Stack trace:
#0 /home/vol15_4/ include_once()
#1 {main}
thrown in /home/vol15_4/ on line 56

What version are you using on your localhost?

Ah, I see str_contains is a PHP 8 feature. PHP 8 is still in development and InfinityFree hasn’t installed it yet.

You can’t use it for a while, I think they [InfinityFree] might make PHP 8 a possibility in about July.


Try to use this instead.

$a = 'Hello world!';

if (strpos($a, 'Hello') !== false) {
    echo 'true';

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.