User Control Panel
Advertisements

HELP US, HELP YOU!

Chopping a $value

 
Post new topic   Reply to topic    Bot Depot Forum Index -> General Chat & Discussion
View unanswered posts
Author Message
Tony_shu
God Like
God Like


Joined: 12 Nov 2003
Posts: 624

Reputation: 42.9Reputation: 42.9Reputation: 42.9Reputation: 42.9

PostPosted: Mon Dec 08, 2003 9:04 am    Post subject: Reply with quote

Is there a way to take a $value and "chop" it, or cut it into a $newvalue? But the $newvalue is a few characters of the original $value.

For example....
User messages the bot to search for "How to program in Perl"
$msg = "How to program in Perl"
...
$newmsg = "How to..."

_________________
Anthony Arslan
@-Squared Enterprises
MacroHard Corporation
Back to top
Scott
Member
Member


Joined: 29 Nov 2003
Posts: 134

Reputation: 32.3Reputation: 32.3Reputation: 32.3

PostPosted: Mon Dec 08, 2003 10:08 am    Post subject: Reply with quote

*lazy* i wouldnt mind knowing that so i could runcate emails on the mod list so normal users dont add and annoy them
Back to top
Keenie
Almost An Agent
Almost An Agent


Joined: 31 Oct 2003
Posts: 1071

Reputation: 52.4

PostPosted: Mon Dec 08, 2003 12:39 pm    Post subject: Reply with quote

to remove characters from the end you could do

Code:
chop($value);


which would take "hi" and return "h"

or you could use this

Code:
$value = substr ($string, $start, $length);


eg

Code:
$string = '12345678901';<br />$grab  = substr($string, 0, 3); <br />print $grab;


which would return "123"
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> General Chat & Discussion All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group