If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > String Operations

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-02-04, 13:24
MrCrud MrCrud is offline
Registered User
 
Join Date: Nov 2003
Posts: 150
String Operations

Hi,

I need to show only the the first 100 characters of a string. I dont know how to do this in PHP. What operators should be used?

My guess is to create something like this:

If string length<100 then
print '$string'
else
print ' this is the part i'm not sure about '


Any help?
__________________
Cheers!

Mr.Crud

There are 10 kinds of people, ones that understand digital, others that dont
Reply With Quote
  #2 (permalink)  
Old 12-02-04, 14:32
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
Try:

echo substr($yourString, 0, 100);
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On