substr function

<?php

$text = 'HelloWorld!';
$n = 5;
$result = substr($text, 0, $n);

echo $result.PHP_EOL; // Hello

Leave a Comment

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