found this regex:
insert " " every 10 characters:
$text = preg_replace("|(.{10})|u", "\${1}"." ", $text);
can you, please, explain what \${1} means. Why using \ and what curly brackets means?
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.
Quoting some portions of the manual page of
preg_replace:You are, apparently, in the second case :
$nAnd, later :
Here, you don’t have anything after what would be
$1— but I suppose it cannot hurt to use the\${1}notation : I find it makes code easier to read, having those{}; and it makes sure you won’t forget to add them the day they are needed.