0

i have an array that is being returned like this:

Array ( [0] => Array ( [0] => ;3750;011; [1] => ;3750;012; [2] => ;3750;013; [3] =>  ;3750;014; [4] => ;3750;015; [5] => ;3750;016; [6] => ;3750;017; [7] => ;3750;018; [8] => ;3750;019; ))

the array is coming from preg_match_all

I have tried to print it with foreach loop and it always returns the same way i can't work with it like this.. and i do not understand what is going on

this is the preg_match_all that it comes from:

$remove = preg_match_all('/;([\d]{4};[\d]{3});/', $str, $m);
Casimir et Hippolyte
  • 88,009
  • 5
  • 94
  • 125
Fábio Linhares
  • 107
  • 1
  • 14

1 Answers1

0

preg_match_all() returns in match result an array of arrays. Then to display all the whole matches you must use:

$remove = preg_match_all('/;([\d]{4};[\d]{3});/', $str, $m);

foreach($m[0] as $item) { echo $item . '<br/>'; }

If you only want the content of your capturing group, just replace $m[0] by $m[1]

Casimir et Hippolyte
  • 88,009
  • 5
  • 94
  • 125