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: Sat, 4 Mar 2023 16:38:20 +0100 Lines: 47 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net T2kP19ud7Uv/Ew4w7aAj7w9FT3vB5Nh2RVO18qHLpFQImUEEOt Cancel-Lock: sha1:G7if8Sc6MGnvWdk2Eldv2nv8Uys= 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:19366 On 3/4/23 15:57, The Doctor wrote: > Arno Welzel wrote: > : The Doctor, 2023-03-04 06:19: > > : [...] > : > What is happening is that the arrauy is being formed by a subarray > : > and the end product is seeing a [[ at the start and a ]] > : > at the end when it should be seeing a [ at the start and a ] at the end. > > : Then don't create a subarray! > > : Again: if you need objects, then create objects and not arrays! > > > J.A AHo and Arno , > > 2 Problems here > > a) Converting a page from a programmer that did not use classes Then you need to rewrite things, how many weeks hasn't you spent on trying to get a proper json of the mess of arrays. Doing it right and rewrite, I think you would have finished a month ago already. Take a look at the following code, test it too and you see the benefit https://pastebin.com/yJC9DJWs If you rewrite things now, you will save time and efforts in the future, specially if there comes changes to the API. > b) Web pages that actually you can search adn > the results give you not what you want. > > If you 2 had quality web pages on PHP > programming , you should be up there and not the pages > Google, yahoo et al as showing. php.net is IMHO a really good source for information. Sometimes Packt hands out free PHP books, just keep on looking at https://www.packtpub.com/free-learning one book a day and after a while you will see the same book again... -- //Aho