Skip to content

Warning: Undefined variable $categories_json in str_replace( array(‘n’,’r’,’t’) ,””, $categories_json);

str_replace( array(‘n’,’r’,’t’) ,””, $categories_json);

With PHP 8.1 the str_replace() function is changed not excepting null.

Solution

str_replace( array(‘n’,’r’,’t’) ,””, $categories_json ?? ‘ ‘);

kudos Pramod