3v4l.org

run code in 300+ PHP versions simultaneously
<?php $t ="10200814|@@|LIPOCOL HCO-40, 204.12 Kilo Drum (10200814)|@@|502192|@@|204.120|@@|2025-10-04|##|10200814|@@|LIPOCOL HCO-40, 204.12 Kilo Drum (10200814)|@@|515232|@@|2653.560|@@|2026-09-13"; $a_produto_teste=""; // print_r(explode('|##|',$t)); $a_produtos_lotes=explode("|##|",$t); foreach ($a_produtos_lotes as $lotes) { $arr = explode('|@@|',$lotes); print_r($arr); $a_produto_teste.= "|@|"."123"."|@|".$arr[2]."|@|".$arr[1]; }
Output for 8.1.0 - 8.1.29, 8.2.0 - 8.2.20, 8.3.0 - 8.3.8
Array ( [0] => 10200814 [1] => LIPOCOL HCO-40, 204.12 Kilo Drum (10200814) [2] => 502192 [3] => 204.120 [4] => 2025-10-04 ) Array ( [0] => 10200814 [1] => LIPOCOL HCO-40, 204.12 Kilo Drum (10200814) [2] => 515232 [3] => 2653.560 [4] => 2026-09-13 )

preferences:
77.49 ms | 403 KiB | 65 Q