Answer the question
In order to leave comments, you need to log in
How to parse number between tags and text?
Hello dear! Save who can ..
There is a page: https://www.reformagkh.ru/myhouse/profile/view/7720435
Need to parse text : residential, units. 66, namely the number " 66 " Used
simple_html_dom
<?php
include_once('lib/curl_query.php');
include_once('lib/simple_html_dom.php');
$html = curl_get('https://www.reformagkh.ru/myhouse/profile/view/7720435');
$dom = str_get_html($html);
$curses = $dom->find('.colspan <table class="col_list">');
foreach($curses as $cours) {
echo $cours->plaintext . '<br>' ;
}
?>
largest, units 13 smallest, units 13
residential units 66 non-residential units 3
total area of residential premises, sq. m 3 631.10 total area of non-residential premises, sq. m 627.80 total area of premises included in the common property, sq
. m m 1 855.00 parking area within the boundaries of the land plot, sq.m 0.00
children's playground Not available sports ground Not available other Not completed
Answer the question
In order to leave comments, you need to log in
Well, for example like this:
$a = "Строка с числом 55 и текстом";
$b = (int)preg_replace('/\D/', '', $a);
var_dump($b);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question