user978905
user978905

Reputation: 5517

Remove beginning of PHP string until it's 13 characters?

I have a variable that needs it's value's shortened until they are 13 characters. It needs to chop off characters from the beginning of the string. Is this built into PHP?

Upvotes: 1

Views: 98

Answers (3)

Nexerus
Nexerus

Reputation: 1088

The substr function is what you're looking for,

$text = "abcdefghijklmnopqrstuvwxyz";
$text = substr($text, -13);

Upvotes: 2

phihag
phihag

Reputation: 288080

Use substr:

$v = substr($v, -13);

Upvotes: 1

user142162
user142162

Reputation:

The following should work for you:

$str = substr($str, -13);

Upvotes: 4

Related Questions