-2

I use php programming for get information from txt file like this:

< n >1< /n >< fr >2,3,4,5,6,7,8< /fr >< fo >9,10,11,12< /fo >

between tag < n > I can get number 1 by using preg_match

$users = preg_match_all("/<".$tag.">[^<]*(.*?)<\/$tag>/si", $content, $matches,PREG_PATTERN_ORDER);

so the data is stored in $user[0] right?

when I convert $user[0] to integer, it turns to 0 !!!

Could you please help me fix this

I want to convert this and insert into database

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
Tanapat Ruengsatra
  • 101
  • 1
  • 2
  • 7

1 Answers1

2

The data is stored in the multi-dimensional array $matches. In $users will be "the number of full pattern matches (which might be zero), or FALSE if an error occurred." see documentation http://www.php.net/manual/en/function.preg-match-all.php

fr4nk
  • 176
  • 1
  • 13