简体   繁体   中英

Firefox displays incorrect value for php strlen function on variable

I have a variable that I am calculating the length of and in all browsers except FF (IE, Chrome, Safari) the value is 0.

However in FF, the value is 65 (see screenshot - value beneath photograph)

screenshot

Link to site page

I have cleared my cache with cc cleaner and using the clear cache option in FF itself.

The code I am using wordpress and the code to display the strlen value is:-

<? $liurl =  get('ksl_linkedin'); 
$liurl = trim($liurl," ");
echo strlen($liurl);
?>

Any help would be greatly appreciated.

Thanks

Jonathan

The result of a PHP function has nothing to do with the browser - it's calculated before the data gets to the browser. (for what it's worth, I get "0" with Firefox as well.)

The only scenario where the browser could play a role is when the data is input by the user some way, or enters the script through a GET or POST variable.

My suspicion is that your get() function returns different values, maybe depending on whether you're logged into Wordpress or not.

What does the function do?

Can you show us an example link?

I bet it has nothing to do with Firefox. PHP is executed at the server side, so it is not interacting with the browser. See also How does PHP work .

What is get() doing? Probably this the source of the problem.

Btw it shows 0 with Firefox 3.6. on a Mac.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM