I'm looking forward a solution to replace multiple values from one of my variable ($type)
This variable can have 34 values (strings). I would like to find a way to create a new variable ($newtype) containing new strings from the replacement of my $type.
I think using str replace would be a good solution, but the only way I see things is creating a big "If ..." (34 times?) but does not seem the best way..
Thanks in advance for you help.
Best regards.
I would advise against storing a string on multiple values in a variable as it will just get messy!
Store variables in an array in the following way
Then if you need to change it you can just do
and you will get (if using print_r)
This means all your values will be neatly stored next to a relevant key and be easily accessable as part of an individual request
which will echo out