Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php Subject: Re: Replace punctuation in an associative array Date: Thu, 2 Mar 2023 14:23:37 +0100 Lines: 25 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net Lhcd3ZHooohV38Z0Vr83FgwgXDCS9r6QuKULmdt2G6TFFIjDoo Cancel-Lock: sha1:gBFfWFGQhEGhim8QRJ1HgCLuXbA= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US-large In-Reply-To: Xref: csiph.com comp.lang.php:19358 On 3/2/23 13:44, The Doctor wrote: A wild guess, this still to do with your json, which you have asked help with quite often. > I wish to replace [[ with [ > > AND > > ]] with ] in an associative array . Don't store objects as an array and place those arrays in an array. Create an object and place the object into the array which is part of your main-object. > How can I do this? If you just look at a string, string replace could work quite well to do this str_replace('[[','[',$str);