- var_dump: documentation ( source)
- preg_replace: documentation ( source)
<?php
$text = '<span style="font-size: small;">test</span><span>Span2</span>';
$text = preg_replace('/<span[^>]*>(.*)<\/span>/Ui', '\\1', $text);
var_dump($text); //string(9) "testSpan2"