Re: String Length ??

From: Date: Mon, 22 Mar 2004 13:07:23 +0000
Subject: Re: String Length ??
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-181132@lists.php.net to get a copy of this message
On Mar 22, 2004, at 1:46 PM, gordon stewart wrote:
======= foreach ($text as $color) { echo "SAF '$color' - "; echo "<B>".strlen($color)."</B><BR>\n"; } ======= QUESTION :- Is this the right code to use ? to find the length of each line ? ($color) - No worries - Ive just copied code from the web
strlen() is the correct function to use here. Use it like: echo strlen($_POST['input_name']); Where $_POST['input_name'] should be replaced by the variable you want to check. strlen() is always right, but it counts the actual charactars of the string (which may differ from those who are shown in the browser, please look at the HTML source instead). Secondly, please use lowercase for HTML tags and use <br /> instead of <BR>... Regards, Filip de Waard

« previous php.general (#181132) next »