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/epizy.com/epiz_28020460/htdocs/static/header.php:56

Stack trace:
#0 /home/vol15_4/epizy.com/epiz_28020460/htdocs/index.php(6): include_once()
#1 {main}
thrown in /home/vol15_4/epizy.com/epiz_28020460/htdocs/static/header.php 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.

5 Likes

Try to use this instead.

<?php
$a = 'Hello world!';

if (strpos($a, 'Hello') !== false) {
    echo 'true';
}
?>
3 Likes

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