- preg_match: documentation ( source)
<?php
$pswd = "Apple1Crab2!";
$specialChar= preg_match("/[!@#&*%]+/", $pswd); // at least one
$numberChar= preg_match("/(?=.*\d){2,}/", $pswd); //two or more digits
$upperChar= preg_match("/(?=.*[A-Z]){2,}/", $pswd); //two or more digits
echo $specialChar . " " . $numberChar . " " . $upperChar;