FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


How do you ignore a specific character in a string?





Denvis
$string = "welcome denvis";

strlen ($string) would be 14

how do i make it 13 and keep the position of each character as they are and ignore the space bar?
Fire Boar
Code:
strlen(str_replace(' ', '', $string));


or

Code:
strlen($string) - substr_count($string, ' ');


Both are functionally equivalent, they just arrive at the correct answer in slightly different ways.
Related topics
FIRE FOX CUTOMIZATIONS
Fortran Tutorials(77)
Medal of Honor: Airborne
C++ int to char and char to int
md5 encryption not reliable.
Wrong order
PHP Game..
German and Cyrillic character sets
The Lord of the Rings Online: Shadows of Angmar
hashing your passwords
Harry Potter Series
Writing to a file -- Python
URL Masking with .TK
Python random password generator in one line
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.