substr function

<?php

$text = 'HelloWorld!';
$n = 6;
$result = substr($text, -$n);

echo $result.PHP_EOL; // World!

Leave a Comment

Your email address will not be published. Required fields are marked *