Just simple question (I’ve google this but not found the answer). What’s the meaning of ?P
in this statement :
preg_match('/^posts\/(?P<id>\d+)$/', $url, $matches);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
(?P<name>patt)is a named subpattern. It means that you can access the match for that subpattern by looking in$matches['id']as well as the usual$matches[1].