I have built a nav menu in wordpres using a posts GUID, and post title, I am taking only part of the title and to do this I am doing the following,
$casestudylist .= "<li class='subnav'><a href=".$v->guid.">". strstr($v->post_title, ":", true)."</a></li>";
however I get the following warning and cannot work out why:
wrong parameter count for strstr()
Basically I am trying to pull all the characters out of a string if they are before a :
.
The PHP version you're using does not support the third parameter of
strstr
Docs, hence the error message. Your usage of the function requires PHP 5.3.0 or higher.You can either upgrade the PHP version on your server or you replace the function call with something similar like:
or if you want to use a helper function which is easier to read (Demo):
Related: strstr to show string before occurance
The third parameter was added in PHP 5.3.0. Is your running PHP version lower than 5.3.0?
Will do the job on lower version of PHP.