The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Truncate Variable
I have searched far and wide but can not find the answer xD
ok, so, how do i truncate (trim) characters off a string so it could have been x characters before but is 10 now? Regards, Nick. |
#2
|
||||
|
||||
<a href="http://uk.php.net/substr" target="_blank">substr()</a>
|
#3
|
|||
|
|||
so:
PHP Code:
is there an if so if it is more than x characers then do this and do this eg: PHP Code:
|
#4
|
||||
|
||||
Yes (but no quotes needed around $str).
|
#5
|
|||
|
|||
ok but what about the second bit?
|
#6
|
||||
|
||||
Second bit ?
|
#7
|
|||
|
|||
PHP Code:
|
#8
|
|||
|
|||
Quote:
PHP Code:
And here is a list of all php string functions, which could come in handy: http://us2.php.net/manual/en/ref.strings.php |
#9
|
|||
|
|||
thanks
ok so i have: PHP Code:
|
#10
|
||||
|
||||
You have to assign the substr to something.
$var = substr(.....) |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|