How to break a string in php after a specified number

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Joseph Cobham
    New Member
    • Jan 2012
    • 23

    How to break a string in php after a specified number

    Hey all
    am new here and i love php. I currently have some troubles implementing a string split in php. I have a database that holds info for my website and the info is user submitted like testimonies. I want a situation where i display the testimony on the homepage but not the entire testimony only a small part say the first 30 chars or so and then add a read more button to it and that will show the full testimony. I knw how to implement the whole database thing all i want is to know how to split or divide the testimony so that some chars are shown on the homepage...
    Just like facebook that you post a long status and only part of it is shown and a link to continue reading the full status.

    Any help will be greatly appreciated.
    Thanks.
    Joseph
  • charles07
    New Member
    • Dec 2011
    • 45

    #2
    hi joseph

    user php substr() fucntion

    W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

    Comment

    • Joseph Cobham
      New Member
      • Jan 2012
      • 23

      #3
      Thank you soooooo much works like a charm just the function i needed..thank you again

      Comment

      Working...