homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

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)

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)

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)

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)

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.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved