a strpos
works or not depending on the parsed string source (entered manually or provided by a third-party mechanism) :
index.php?option=com_ars&view=release&id=8
The strpos instruction is
$debug = "found '?' : " . ((strpos($url, '?') === false) ? 'false' : 'true');
The strpos always return false.
I tried mb_strpos
, I tried all sorts of en/de-coding to no avail ( utf8_encode
, utf8_decode
, even using sprintf
, iconv
, ...).
I best hint I have up to know is that, when the string is provided by a 3rd-party mechanism a convert_uudecode
gives an error
Warning: convert_uudecode(): The given parameter is not a valid uuencoded string
while for the manually entered it returns 8AX9| 3".
I'm no php specialist at all, but this make me think of a characterset problem.
Any idea on how I should do my strpos ?
First of all, I see that there is one parentheses "(" too much. (you have 3 opening "(", and 2 closing ")").
Secondly, if you want your variable $ok to be true if he FINDS the "?" sign, then you should test with !==
$ok = strpos($url, '?') !== false;
$ok will now be true if a quotation mark "?" is found.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.