edyonline
asked on
replace all variable in php using regex
I have a lot of php files and in order to standardize the coding structure, I need to make all array variable to be 'more' valid by adding quote in between.
For example:
$_POST[variablename] replaced to $_POST['variablename']
$_SESSION[variablename1][v ariablenam e2] replaced to $_SESSION['variablename1'] ['variable name2']
$_GET['variablename'] is to be skipped and do nothing because it's in good format
Now, I know I can use perl or awk to go over all files and using regex to insert the quote. What's the quickest way to achieve this and how do I do it?
For example:
$_POST[variablename] replaced to $_POST['variablename']
$_SESSION[variablename1][v
$_GET['variablename'] is to be skipped and do nothing because it's in good format
Now, I know I can use perl or awk to go over all files and using regex to insert the quote. What's the quickest way to achieve this and how do I do it?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
- flub