At the end of this post, Jackdowson123 edited $ data = mb_convert_encoding ($ data, & nbsp; "UTF-8", & nbsp; "gb2312") from 2013-06-2200:36:32 "); & nbsp; regular expression matching function
This post was last edited by Jackdowson123 at 00:36:32 $ data = mb_convert_encoding ($ data, "UTF-8", "gb2312 ");
Preg_match_all ('/\> (\-? \ D + \. \ d +) \ <\/font \>/', $ data, $ matches );
Return var_dump ($ matches );
$ Data ='
Dormitory power remaining query result
As of this morning, the power remaining in 22 416 bedroom buildings: 20.34 degrees.
(Query operation Execution time)
Note:
(1) normally, the electricity management system automatically reads data from AM to am every day, obtains the power consumption since am the previous day, and calculates the remaining power. if the remaining power is less than or equal to 0 degrees, the power supply stops waiting for the user to renew the electricity bill.
(2) after the electricity fee is paid off, the system generally supplies power 10 minutes later.
Close
'
Why is a null value returned here, and if $ data = '20. 34 degrees. ', but 20 can be returned. 34. does anyone know why? share regular HTML :(\-? \ D + \ .. \... 'data-pics = ''>
------ Solution --------------------
Preg_match_all ('/\> (\-? \ D + \. \ d +) \ <\/font \>/I ', $ data, $ matches );
I case-insensitive