PHP function to truncate a string...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Smut
    Confirmed User
    • Sep 2002
    • 654

    #1

    PHP function to truncate a string...

    Can someone please let me know which function I should be looking for to truncate a variable string to a set number of characters?

    Ex. $string="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    function to truncate("$string", 5);
    echo function to truncate(); //Would output "ABCDE"

    Any assistance is appreciated.

    Thanks
  • Darth Vader
    Confirmed User
    • Jan 2005
    • 144

    #2
    I find your lack of truncated strings disturbing.
    Everything is going according to plan.

    Comment

    • StuartD
      Sofa King Band
      • Jul 2002
      • 29903

      #3
      substr ( string string, int start [, int length] )
      This is me on facebook
      This is me on twitter

      Comment

      • StickyFinger
        Registered User
        • Jan 2002
        • 18

        #4
        More info on it.
        http://us4.php.net/manual/en/function.substr.php
        Coming soon

        Comment

        Working...