I need to be able to separate the first letter of a string and put it in a <span>
. Example:
$string = "Deportes";
And let the result be:
<h1><span>D</span>eportes</h1>
It can be through PHP, JavaScript or jQuery.
I need to be able to separate the first letter of a string and put it in a <span>
. Example:
$string = "Deportes";
And let the result be:
<h1><span>D</span>eportes</h1>
It can be through PHP, JavaScript or jQuery.
you can do it with substr() method
example:
In my opinion, the more workload you remove from your server, the more efficient it will be, therefore I suggest that you implement this functionality in javascript jquery
given the following code you get the desired result without any intervention of your server resources being able to attend other calls to your application.