convert to int php


convert to int php

我使用php编程从文本文件中获取信息,如下所示:

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

在标签< n >之间,我可以通过使用preg_match

获得编号1
$users = preg_match_all("/<".$tag.">[^<]*(.*?)<'/$tag>/si", $content, $matches,PREG_PATTERN_ORDER);

所以数据存储在$user[0]中,对吗?

当我将$user[0]转换为整数时,它变成0 !!

你能帮我修一下这个吗

我想转换这个并插入到数据库

数据存储在多维数组$matches中。在$users中,将为"完整模式匹配的数量(可能为零),如果发生错误,则为FALSE。"参见文档http://www.php.net/manual/en/function.preg-match-all.php