Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm looking for a way to retrieve the length of string in a variable with php. But the variable isn't a normal string data type variable, its a variable that retrieves text from my html page using "_POST". Please help.
Posted
Updated 19-Jan-21 16:20pm

$str = 'abcdef';
echo strlen($str); // returns 6

$str = ' ab cd ';
echo strlen($str); // returns 7
?>
 
Share this answer
 
Comments
Gil-B 15-Nov-13 7:38am    
Thanks, but this won't work if the variable I'm trying to retrieve its value looks like this
"$str=$_POST ['password'] //password is a text input type in the html

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900