• support@answerspoint.com

Substring to take all letters after the 4th character

1808

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);

 

1Answer


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 7 years ago
  • Community  wiki

Your Answer

    Facebook Share        
       
  • asked 7 years ago
  • viewed 1808 times
  • active 7 years ago

Best Rated Questions