Runels Posted August 9, 2023 Share Posted August 9, 2023 this is the string "1 x MAKE: Behringer, 1 x MODEL: X-32, 1 x Problem with unit: Not powering on" I want to get this from it and it changes with each unit. Behringer X-32 Not powering on Then store it in a mysql database Quote Link to comment Share on other sites More sharing options...
Solution Barand Posted August 9, 2023 Solution Share Posted August 9, 2023 One way... $str = "1 x MAKE: Behringer, 1 x MODEL: X-32, 1 x Problem with unit: Not powering on"; $a = explode(': ', $str); unset ($a[0]); foreach ($a as $b) { $results[] = explode(',', $b)[0]; } echo '<pre>results = ' . print_r($results, 1) . '</pre>'; output... results = Array ( [0] => Behringer [1] => X-32 [2] => Not powering on ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.