Tag Archives: count

Count words using Regex

Yes, i know, very very easy. But i am leaving this here as reference: $texto = “how to count words in a very simple step”; $contagem = preg_match_all(“/\w+/”, $texto, $blaharray); echo $contagem; // 9 For further reading: Regular Expressions info preg_match() preg_match_all()

Find duplicate records in SQL table

There are a few ways to do this, but i am leaving this one here so its easy to find. SELECT nome, COUNT(nome) FROM Patrimonio GROUP BY nome HAVING ( COUNT(nome) > 1 ) This returns a list with two columns of records that exist in table “Patrimonio” more than once. A column for “nome”… Read More »