PHP read content and do a preg_match
<p>I am trying to get the font-family only if the selector is starting with @font-face, and breaks if selector is not starting with @font-face, but below do not seem to work.</p>

<h3>CSS file content:</h3>

<pre><code>@font-face {
  font-family: 'someFonts'; 
}

@font-face {
  font-family: 'someotherFonts';    
}

.style {
  font-family: 'someFonts';
}
</code></pre>

<p><strong>PHP:</strong></p>

<pre><code>$content = file_get_contents($file-&gt;uri);
if (!preg_match('#@font-face {([^;]+);#i', $content, $matches)) {
  break;
}

$fonts = array();
if (preg_match_all('#font-family:([^;]+);#i', $content, $matches)) {
  foreach ($matches[1] as $match) {
    if (preg_match('#"([^"]+)"#i', $match, $font_match)) {
      $fonts[] = $font_match[1];
    }
    elseif (preg_match("#'([^']+)'#i", $match, $font_match)) {
      $fonts[] = $font_match[1];
    }
  }
}
</code></pre>

<p>Any hint is very much appreciated. Thanks</p>
