Call to undefined function str_starts_with()

Hello

I get the error Call to undefined function str_starts_with() although I’m on PHP 8.0.0.

My condition is if (str_starts_with($_POST[$this->_type], Member::PREFIX_CLOSED_ACCOUNTS))

It seems in contradiction with the documentation.

I don’t know if it will work but maybe something like the following?

if (str_starts_with($_POST[$this->_type], Member::PREFIX_CLOSED_ACCOUNTS) === true)

No, I get the same result.

I am confused. Isn’t this just a value? Just compare it. If $_POST[$this->_type]===true) ???

Run Phpinfo and make sure you are actually using version 8

1 Like

@benanamen

You’re right : php -v was telling me that I was on PHP 8.0.0 but, according to var_dump(PHP_VERSION); , I was still in 7.4.

I’ve completed the version upgrade and everything’s fine now.

Thanks

Nice catch Benananmen!

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service