1
I am using the following code to capture the first letter of each word. How can I add one more rule in the preg_split
to ignore words such as: da, do, das, dos, de?
$nome = preg_split("/[\s,_-]+/", $loja->nome);
$iniciais = "";
foreach($nome as $n)
$iniciais .= $n[0];
echo $iniciais;
It didn’t work. I don’t think this is the problem, since the code without removing these words is working, but the code is inside a foreach, because I need to get the initials of all stores in the system.
– Diego Vieira
@Diegovieira What was the problem of not working? what happened, because, I even managed a test page and it worked! now for example I made an adjustment to be without the problem of empty fields check! and let me know and if you have problems report the problem!
– novic
Now it worked perfectly! Thanks!
– Diego Vieira