- preg_match: documentation ( source)
- print_r: documentation ( source)
<?php
$pattern = '/data-videoid="([^"]+)/';
$subject = '<amp-youtube width="640" height="360" data-videoid="h7rhqXbdIts" layout="responsive"></amp-youtube>';
$result = preg_match( $pattern, $subject , $matches );
echo $result;
print_r($matches);
?>