roulendz's avatar

PHP textarea input to nested array, using regex, preg_replace!

Hello awesome people, I was wondering, is it possible using preg_replace to make textarea data into nested array if it is entered in pattern like this

EUR/USD 

SELL: 1.0723 TP: 1.0692 SL: 1.0812 



USD/JPY 

BUY: 109.14 TP: 109.44 SL: 108.24 



GBP/USD 

SELL: 1.2823 TP: 1.2792 SL: 1.2912



USD/CHF 

BUY: 0.9972 TP: 1.0005 SL: 0.9885

This is how input text-pattern would look like. And I would like no nest all by Currencie BUY TP SL And then use foreach loop to store the data seperatly in rows.

Thanks any help would be appreciated

0 likes
0 replies

Please or to participate in this conversation.