i want detect some words when read first line file.
this my code
$open = @fopen($file,"r");
$line = @fgets($open);
$close = @fclose($open);
return preg_match('/\<\?php/',$line);
words for detect
"<?php","<?","<html>"
i do not know how do it with multiple words, any help please
http://php.net/manual/en/regexp.reference.alternation.php - alteration can help you. In your particular case, you have to extend your regexp as the following:
return preg_match('/^<(?:\?(?:php)?|html>)/',$line);