- preg_match: documentation ( source)
<?php
$artigos = [
"Art. 1 lala 23",
"Art. 2 lala 23",
"Art. 3 lala 23",
"Art. 4345 lala 23",
];
$artigos_len = count($artigos) -1;
for ($i=0; $i <= $artigos_len; $i++) {
preg_match("/Art\. (\d+)/i",$artigos[$i],$match);
echo "<ul class='artigo {$match[1]}'></ul>\n\r";
}