I need an expression for PHP preg_replace so just replace “[” and “]” with “(” and “)” only for none PHP arrays.
Please read the question and see the sample carefully…
Thank you…
Sample:
// input
$foo[];
bar["name"];
// output
$foo[];
bar("name");
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.
I don’t know what “only for none PHP arrays” means, but if you’re just replacing individual characters, why use a preg?
str_replace()should work just fine.