• support@answerspoint.com

Substring to take all letters after the 4th character


I only have a basic understanding of substring. I am trying to extract the first 4 characters as a string variable and extract the rest of the characters in another string variable. How may I do this with substring? With PHP

$rest = substr("jKsuSposdfsdfsdrtTopics", -3, 1);
$rest2 = substr("jKsuSportsdffdsTopics", 4, 0);




The second argument is the starting index, and the third argument is the length of the string. If the 3rd argument is missing, you'll get the rest of the string.

$rest = substr("jKsuSposdfsdfsdrtTopics", 0, 4);
$rest2 = substr("jKsuSportsdffdsTopics", 4);
  • answered 6 years ago
  • Community  wiki

Your Answer

    Facebook Share        
  • asked 6 years ago
  • viewed 1567 times
  • active 6 years ago

Best Rated Questions