<!DOCTYPE html>
<html>
<body>
<?php
$input = [
"Red",
"Pink",
"Green",
"Blue",
"Purple"
];
$result = preg_grep("/^p/i", $input);
print_r($result);
?>
</body>
</html>
Array ( [1] => Pink [4] => Purple )