Amir Arain Amir Arain - 4 months ago 18
PHP Question

Warning: strpos() expects at most 3 parameters, 23 given in page.php on line 9

1.List item

if (strpos($page_name_ulter, 'dissertation' || $page_name_ulter, 'vendor' || $page_name_ulter, 'js' || $page_name_ulter, 'css' || $page_name_ulter, 'bootstrap' || $page_name_ulter, 'CI3Xmuqx6MsCFcJf2wod6s0P9Q' || $page_name_ulter, 'vendor' || $page_name_ulter, 'vendor' || $page_name_ulter, '=' || $page_name_ulter, 'essay?' || $page_name_ulter, 'input' || $page_name_ulter, 'main.js' || $page_name_ulter, 'main' || $page_name_ulter, 'php/js' || $page_name_ulter, '/' || $page_name_ulter, '.js' || $page_name_ulter, 'rating' || $page_name_ulter, 'intlTelInput' || $page_name_ulter, '.min' || $page_name_ulter, 'images') !== false) { return false; }

Answer

Since strpos() will not work with multiple && OR || conditions, So you need to add ), strpos and !== false like below:

if (strpos($page_name_ulter, 'dissertation') !== false ||  strpos($page_name_ulter, 'vendor') !== false || strpos($page_name_ulter, 'js') !== false || strpos($page_name_ulter, 'css') !== false || strpos($page_name_ulter, 'bootstrap') !== false || strpos($page_name_ulter, 'CI3Xmuqx6MsCFcJf2wod6s0P9Q') !== false ||strpos($page_name_ulter, 'vendor') !== false || strpos($page_name_ulter, 'vendor') !== false || strpos($page_name_ulter, '=') !== false || strpos($page_name_ulter, 'essay?') !== false || strpos($page_name_ulter, 'input') !== false || strpos($page_name_ulter, 'main.js') !== false || strpos($page_name_ulter, 'main') !== false || strpos($page_name_ulter, 'php/js') !== false || strpos($page_name_ulter, '/') !== false || strpos($page_name_ulter, '.js') !== false || strpos($page_name_ulter, 'rating') !== false || strpos($page_name_ulter, 'intlTelInput') !== false || strpos($page_name_ulter, '.min') !== false || strpos($page_name_ulter, 'images') !== false) { return false; }

For more details about function :- http://php.net/manual/en/function.strpos.php

Note:- More better solution is using preg_match()

Check manual for it:- http://php.net/manual/en/function.preg-match.php

Comments