View Full Version : preg_replace $var['foo'] with $var[foo]
harmor19
06-08-2007, 03:31 AM
How can I remove the quotes in an array using preg_replace?
I want $var['foo'] to be $var[foo].
Eikinskjaldi
06-08-2007, 06:05 AM
How can I remove the quotes in an array using preg_replace?
I want $var['foo'] to be $var[foo].
I assume this is some string representation of code going to eval somewhere? otherwise you are probably asking the wrong question. Do you want to replace all instances of ' or just those in [ ] ? Since there is no ambiguity in your expression I would suggest using str_replace, it's a lot faster.
mixed str_replace ( mixed $search, mixed $replace, mixed $subject [, int &$count] )
A bit more context as to what you are trying to do would help.
harmor19
06-08-2007, 11:13 AM
The problem is with my "Advanced BBCode (https://vborg.vbsupport.ru/showthread.php?t=149107)" hack. It's that last post on the first page.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.