Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

counting characters with return

trying to count characters and return a statement based on the answer

11:12 am on May 31, 2004 (gmt 0)

10+ Year Member

I am having a little bit of trouble with a small script I wrote and I cannot figure out what is wrong with it.

I use the var $url to capture a specific URL's.

with that knowledge here is the script
if (count_chars($url)>100)
$url= 'wwWebmasterWorldebsite.net/...';
echo $url
now, this is supposed to return only if the characters are greater than 100 but it returns no matter what the characters are....

Can anyone see what I am going wrong?



11:38 am on May 31, 2004 (gmt 0)

WebmasterWorld Senior Member henry0 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

You can aslo built your quest around of:



echo $num_char;

Will output: 14

and then integrate the result in your script

12:45 pm on May 31, 2004 (gmt 0)

10+ Year Member

Thank you for your reply. There is another thing that I would like to do but I am not sure how.... I am looking on php.net for a command that will parse the string up to the desired about and then cut it off.

so if
$string = 'webmasterworld'

I can have it output only


if I choose.

Do you happen to know of a command that will work for that?

I am pretty sure that I can do that with substr();

12:59 pm on May 31, 2004 (gmt 0)

10+ Year Member

yep, that was it.... I incorporated my php script with you said and used the substr() function.... thank you much for all of your help.



Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month