Can anyone explain why this substr is not working ? What am I missing ?
<?= substr(htmlentities($movie->movie_name) , 0 , 10) ?>
You probably want to switch the order of these function calls, like this:
<?= htmlentities(substr($movie->movie_name, 0, 10)); ?>
htmlentities
replaces special characters, such as <
with <
. Where <
was only one character for the substr
function, <
took 4 spaces. Even worse, it could be cut of halfway, where you end up with The big &l
.