I need to receive a long string with lots of characters and 'cut' it to generate a string with the number of characters I determine, how can I do that?
Example:
$text = 'This is a long string with a lot of characters';
The $text
string contains 46 characters in this example.
I need to generate a $newText
string with only the 20 first characters, like this:
$newText = 'This is a long strin';