Re: Replace punctuation in an associative array
"J.O. Aho" <[email protected]> Sat, 4 Mar 2023 16:38:20 +0100
| Newsgroups | comp.lang.php |
|---|---|
| Message-ID | <[email protected]> |
On 3/4/23 15:57, The Doctor wrote: > Arno Welzel <[email protected]> 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