Take a part of a string (PHP) -


We are trying to get some parts of the string.

We have the string:

Location: 32: Kindle + LOC: 102AD: Amount: 294

Want to keep them in different stars. For example $ location = 32 and $ Dad + Loc = 102AD

the values ​​change according to each string, but it will always be created: < Code> Location: {number}: Kindle + LoC: {code}: Amount: {number}

So ... how do we get those values?

Easy fast forward approach:

  $ string = "Location: 32: Kindle + LoC: 102AD: Ammount: 294 "; $ Arr = Explosion (":", $ string); $ Location = $ arr [1]; $ Dad_Loc = $ Arrival [3]; $ Ammount = $ arr [5];  

Comments