Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #19367

Re: Replace punctuation in an associative array

From "J.O. Aho" <user@example.net>
Newsgroups comp.lang.php
Subject Re: Replace punctuation in an associative array
Date 2023-03-05 00:41 +0100
Message-ID <k6i39aFkhvjU1@mid.individual.net> (permalink)
References (1 earlier) <k6dl2dFtv97U1@mid.individual.net> <ttukdq$1t41$1@gallifrey.nk.ca> <k6h06kFfavmU1@mid.individual.net> <ttvm80$1hgn$1@gallifrey.nk.ca> <k6h6vcFdcehU1@mid.individual.net>

Show all headers | View raw


On 3/4/23 16:38, J.O. Aho wrote:
> On 3/4/23 15:57, The Doctor wrote:

>> 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.

Looking at your old posts, using the above code you would endup with 
something like this (not tested):

https://pastebin.com/bF6bZseu

this has same issues with unvalidated data, but at least now no one will 
get the items for free as the transaction value is calculated while 
adding items to the carts items array.

if it's mainly changing how to load values from post, it's a short times 
convertion, if you store vallues in the session, then you need slightly 
more changes, specially if you need to access values, but should be quit 
simple to find out where with help of php lint function (php -l 
sourcodefile.php).


Keep in mind nothin is a 100% solution for your issue as I haven't 
bothered really go into the API that is used but just a bit based on 
your posts in this group.

And please, what ever you do, don't go with the str_replace, it's not 
the solution to your issue, it will just make things a lot harder to 
maintain.

-- 
  //Aho

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Replace punctuation in an associative array The Doctor <doctor@doctor.nl2k.ab.ca> - 2023-03-02 12:44 +0000
  Re: Replace punctuation in an associative array "J.O. Aho" <user@example.net> - 2023-03-02 14:23 +0100
    Re: Replace punctuation in an associative array The Doctor <doctor@doctor.nl2k.ab.ca> - 2023-03-03 01:03 +0000
      Re: Replace punctuation in an associative array "J.O. Aho" <user@example.net> - 2023-03-03 10:36 +0100
    Re: Replace punctuation in an associative array Ezimene nimi Teine nimi <techfan55555@hotmail.com> - 2023-03-08 09:22 -0800
      Re: Replace punctuation in an associative array The Doctor <doctor@doctor.nl2k.ab.ca> - 2023-03-09 01:24 +0000
  Re: Replace punctuation in an associative array Arno Welzel <usenet@arnowelzel.de> - 2023-03-03 08:14 +0100
    Re: Replace punctuation in an associative array The Doctor <doctor@doctor.nl2k.ab.ca> - 2023-03-04 05:19 +0000
      Re: Replace punctuation in an associative array "J.O. Aho" <user@example.net> - 2023-03-04 11:07 +0100
      Re: Replace punctuation in an associative array Arno Welzel <usenet@arnowelzel.de> - 2023-03-04 14:42 +0100
        Re: Replace punctuation in an associative array The Doctor <doctor@doctor.nl2k.ab.ca> - 2023-03-04 14:57 +0000
          Re: Replace punctuation in an associative array "J.O. Aho" <user@example.net> - 2023-03-04 16:38 +0100
            Re: Replace punctuation in an associative array "J.O. Aho" <user@example.net> - 2023-03-05 00:41 +0100
              Re: Replace punctuation in an associative array The Doctor <doctor@doctor.nl2k.ab.ca> - 2023-03-04 23:58 +0000
                Re: Replace punctuation in an associative array "J.O. Aho" <user@example.net> - 2023-03-05 01:39 +0100
                Re: Replace punctuation in an associative array doctor@doctor.nl2k.ab.ca (The Doctor) - 2023-03-05 00:52 +0000
                Re: Replace punctuation in an associative array "J.O. Aho" <user@example.net> - 2023-03-05 12:16 +0100
                Re: Replace punctuation in an associative array The Doctor <doctor@doctor.nl2k.ab.ca> - 2023-03-05 14:08 +0000
                Re: Bureaucracy (Was: Replace punctuation in an associative array) "J.O. Aho" <user@example.net> - 2023-03-06 09:30 +0100
                Re: Replace punctuation in an associative array The Doctor <doctor@doctor.nl2k.ab.ca> - 2023-03-07 16:43 +0000
                Re: Replace punctuation in an associative array "J.O. Aho" <user@example.net> - 2023-03-07 18:56 +0100
                Re: Replace punctuation in an associative array The Doctor <doctor@doctor.nl2k.ab.ca> - 2023-03-07 22:53 +0000
                Re: Replace punctuation in an associative array Arno Welzel <usenet@arnowelzel.de> - 2023-03-08 23:44 +0100
                Re: Replace punctuation in an associative array The Doctor <doctor@doctor.nl2k.ab.ca> - 2023-03-09 01:25 +0000
                Re: Replace punctuation in an associative array Arno Welzel <usenet@arnowelzel.de> - 2023-03-10 09:08 +0100
                Re: Replace punctuation in an associative array The Doctor <doctor@doctor.nl2k.ab.ca> - 2023-03-10 15:20 +0000
                Re: Replace punctuation in an associative array doctor@doctor.nl2k.ab.ca (The Doctor) - 2023-04-01 14:08 +0000
                Re: Replace punctuation in an associative array doctor@doctor.nl2k.ab.ca (The Doctor) - 2023-04-06 00:26 +0000
                Re: Replace punctuation in an associative array doctor@doctor.nl2k.ab.ca (The Doctor) - 2023-04-12 22:45 +0000
                Re: Replace punctuation in an associative array "J.O. Aho" <user@example.net> - 2023-04-13 07:41 +0200
                Re: Replace punctuation in an associative array doctor@doctor.nl2k.ab.ca (The Doctor) - 2023-04-13 11:50 +0000
                Re: Replace punctuation in an associative array "J.O. Aho" <user@example.net> - 2023-04-13 14:26 +0200
                Re: Replace punctuation in an associative array doctor@doctor.nl2k.ab.ca (The Doctor) - 2023-04-13 22:37 +0000
                Re: Replace punctuation in an associative array doctor@doctor.nl2k.ab.ca (The Doctor) - 2023-04-14 01:12 +0000
                Re: Replace punctuation in an associative array "J.O. Aho" <user@example.net> - 2023-04-14 19:34 +0200
                Re: Replace punctuation in an associative array doctor@doctor.nl2k.ab.ca (The Doctor) - 2023-04-14 22:21 +0000
                Re: Replace punctuation in an associative array doctor@doctor.nl2k.ab.ca (The Doctor) - 2023-04-16 12:40 +0000
                Re: Replace punctuation in an associative array "J.O. Aho" <user@example.net> - 2023-04-16 22:03 +0200
  Re: Replace punctuation in an associative array Ezimene nimi Teine nimi <yyyyyeeeee00000@writeme.com> - 2023-03-06 03:23 -0800
    Re: Replace punctuation in an associative array The Doctor <doctor@doctor.nl2k.ab.ca> - 2023-03-06 16:21 +0000
  Re: Replace punctuation in an associative array V <vvvvvvvvvvvvvvvvvvvv11111@mail.ee> - 2023-04-03 06:55 -0700
    Re: Replace punctuation in an associative array doctor@doctor.nl2k.ab.ca (The Doctor) - 2023-04-03 14:18 +0000
  Re: Replace punctuation in an associative array Angel <heyeeeeeeeeeeeeeeeeeee@gmail.com> - 2023-04-15 05:33 -0700
    Re: Replace punctuation in an associative array doctor@doctor.nl2k.ab.ca (The Doctor) - 2023-04-15 13:52 +0000

csiph-web