Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 成对分组数据_Php - Fatal编程技术网

Php 成对分组数据

Php 成对分组数据,php,Php,编辑:我觉得我应该澄清一下,就我所知,我没有语法分析问题。我已经在使用DOM和xpath了 感觉很好。我遇到的问题是在使用 已在循环中解析结果 我有一个很长的HTML字符串,我正试图用PHP解析。到目前为止,我已经有了preg_match,它们正在隔离我想要的东西,但是我想得到一些帮助来优化输出。 HTML格式很差,它是一个长字符串,不在任何标记之间,但基本上包含标题,后跟一个或多个段落等等 因此,我的preg_match正则表达式正在隔离标题和段落,我使用for循环获取小于或等于13个结果,因

编辑:我觉得我应该澄清一下,就我所知,我没有语法分析问题。我已经在使用DOM和xpath了 感觉很好。我遇到的问题是在使用 已在循环中解析结果

我有一个很长的HTML字符串,我正试图用PHP解析。到目前为止,我已经有了preg_match,它们正在隔离我想要的东西,但是我想得到一些帮助来优化输出。 HTML格式很差,它是一个长字符串,不在任何标记之间,但基本上包含标题,后跟一个或多个段落等等

因此,我的
preg_match
正则表达式正在隔离标题和段落,我使用for循环获取小于或等于13个结果,因为它们将输出到的div的维度有限

标题的数量是一个未知变量,每个标题的段落数量也是一个未知变量。 我想做的是,确保输出总是以段落结尾,而不管前面有多少个匹配项(有时一行有两个标题。这是一个数据输入问题,我也在处理,但控制力要小得多)。 我意识到for循环的“小于或等于”部分是有问题的。我想解决办法是分离标题段落对,然后对它们进行计数,我只是在这方面没有取得任何进展

会不会有一种明亮的火花把我引向正确的方向?:)

我必须使用的字符串示例如下:

<h2 class="border_top">Description:</h2>
<b>Surroundings</b><br /><br />Dunoon is the marine gateway to the Loch Lomond and the Trossachs National Park, and has a number of
local amenities including a cinema, two supermarkets, several choice
restaurants and bars, primary and secondary schools, library, Post
Office, community hospital, doctor surgeries and veterinary clinic,
leisure centre with swimming pool and gym.<br />Innellan has its own
primary school, shop and Post Office. There is a busy village hall and
a popular restaurant nearby. There are a number of clubs in the
Innellan area, including golf, bowling, tennis, cricket and
sailing.<br /><br /><b>Amenities</b><br /><br />A regular local bus
service operates in the area and there are bus and coach services to
popular towns across the West of Scotland. Frequent passenger ferry
services operate from Dunoon Pier to Gourock with regular bus and
train connections to Glasgow Central railway station. The train stops
at Paisley Gilmore Street en route, which is convenient for access to
Glasgow Airport. Western Ferries located at Hunter&#39;s Quay, offers
a regular vehicle service to McInroys Point in Gourock for access to
the national road network.<br /><br /><b>Contact</b><br /><br />To
view this property, please contact <b>Someone Somewhere</b> on <b>01234
467890</b> or <b>09876 543210</b><br /><br /><b>Porch/Vestibule 1.7m x
1.8m</b><br /><br />Modern PVCu wood effect front door set between glazed side panels. Cupboard with electricity meter and room for coats
and boots. Solid wooden flooring and shelving. Glazed door to lower
hall.<br /><br /><b>Lower Hall 2.7m x 3.65m at widest point</b><br
/><br />Provides access to double garage and WC, and to the winding
staircase to lower landing area. Solid wooden flooring.<br /><br
/><b>Downstairs Cloakroom 2m x 0.9m</b><br /><br />Under stairs WC and
wash basin with adequate headroom. Cork effect flooring. Extractor
fan. Fitted shelving.<br /><br /><br /><b>Lower Landing 1.5m x
3.8m</b><br /><br />Carpeted. Large cupboard with double doors, fitted with shelving and hanging rail.<br />Door access to the master bedroom
and stairs up to the next landing.<br /><br /><b>Master Bedroom 4.9m x
5.5m</b><br /><br />This large carpeted area featuring 2 large  length windows, offering fantastic views of the Firth of Clyde and hills on
the opposite shore. There is also a side window making the room
bright. Access from here through door to the walk-in dressing room
area.<br /><br /><b>Dressing Room 3.85m x 2.2m</b><br /><br />Carpeted
with shelving and hanging rails and with plenty of room for additional
storage. Access through door to the en-suite bathroom. Extractor
fan.<br /><br /><b>En-suite 2m x 3.1m</b><br /><br />Walk-in shower
measuring 1100mm x 800mm, chrome towel rail, bidet, WC and wash basin
inset into fitted cupboards. Privacy glazed window and extractor
fan.<br /><br /><b>Main Landing 2.4m x 3.4m</b><br /><br />Solid wood
flooring. High ceiling with Velux roof light. Access to kitchen,
utility room and bedroom/study.<br /><br /><b>Bedroom/Study 4.1m x
4.2m</b><br /><br />This room which is currently used as a study, would be a generous double bedroom. Large fitted wardrobe. Loft
access. Twin windows with amazing views over the river. Solid wooden
flooring.<br /><br /><b>Kitchen 4.6m x 3.5m</b><br /><br
/>Double-doors from the main landing, leads into this bright and
spacious modern fitted kitchen with lots of storage and countertop,
some providing serving access to the dining area. Double window, tiled
splash-backs and hob extractor hood. Solid wooden flooring. Access to
dining area and to Sun Room/Family Room/Office.<br /><br /><b>Dining
Area 4.6m x 4.3m</b><br /><br />Single window in addition to glazed
French doors that open to a small guarded balcony with wonderful sea
views. Solid wooden flooring continues in from the kitchen to this
bright dining area.<br /><br /><b>Sun Room/Family Room/Office 3.1m x
4.3m</b><br /><br />Currently used as an office, this room has a window to the side and two to the back of the house, together with
patio doors which provide access to the decking. This bright and sunny
room has solid wooden flooring.<br /><br /><b>Utility Room 1.65m x
3.05m</b><br /><br />Worktop with stainless steel sink and tiled splash-back. Fitted shelving. Room for washing machine. Modern PVCu
back door with access to decking and garden. Window to garden.<br
/><br /><b>Upper Landing 2.7m x 2.3m</b><br /><br />Carpeted area with
fitted cupboard and access to lounge, bedroom and bathroom.<br /><br
/><b>Bathroom</b><br /><br />Fitted bath with mixer taps. WC and wash
basin inset into fitted cupboard. Shower unit with electric shower.
Cork effect flooring. Privacy glazed double windows and extractor
fan.<br /><br /><b>Bedroom 2.75m x 3.9m</b><br /><br />Peaceful
generous double bedroom with double window looking out onto the back
garden. Large, fitted, double-door wardrobe with fitted shelving and
hanging rail. Carpeted.<br /><br /><b>Lounge 5.5m x 4.2m</b><br /><br
/>Double-door entrance into this bright carpeted area. The lounge
features a total of 6 windows, 2 single side facing at each end, 2
facing the river as well as 2 x  length windows offering fabulous
views of the Firth of Clyde and of the hills on the other side.
Elegant fire surround with living flame gas fire.<br /><br /><b>Double
Garage 6m x 6.5m</b><br /><br />Plenty of room in this double garage,
containing double up and over door and modern gas water heating
system.<br /><br /><b>Garden</b><br /><br />Terraced front garden with
mature planting and additional car parking. Side gate and pathway from
the front of the property leads along the side of the house and up
wooden stairs to timber decking. Decking extends along the rear and
steps up to a small grassed area with flower bed and planters. Pathway
at the other side of the house leads to a planted area at rear of the
house.<br /> <br />                         
<a name="map"></a>
说明:
周围环境

Dunoon是通往洛蒙湖和特罗萨克斯国家公园的海上门户,有许多 当地的便利设施包括一家电影院、两家超市、多种选择 餐厅和酒吧、中小学、图书馆、邮政 办公室、社区医院、医生手术室和兽医诊所, 有游泳池和健身房的休闲中心。
Innellan有自己的 小学、商店和邮局。这里有一个繁忙的乡村礼堂和 附近有一家很受欢迎的餐馆。世界上有许多俱乐部 Innellan区域,包括高尔夫、保龄球、网球、板球和网球 航海。

便利设施

一辆普通的本地公共汽车 服务在该地区运营,并提供公共汽车和长途汽车服务 苏格兰西部受欢迎的城镇。定期客运渡轮 服务从Dunoon码头到Gourock,有定期巴士和 列车连接格拉斯哥中央火车站。火车停了 在途中的佩斯利·吉尔莫尔街,方便前往 格拉斯哥机场。位于亨特39号的西部渡轮;s码头,报价 前往Gourock McInroys Point的常规车辆服务,以便进入 国家公路网。

联系 查看此属性,请致电01234与某人联系 467890或09876 543210

门廊/前厅1.7m x 1.8m

现代PVCu木质效果前门,位于玻璃侧板之间。带电表的橱柜和存放衣服的房间 还有靴子。实木地板和架子。下玻璃门 大厅。

最宽点下大厅2.7m x 3.65m

提供通往双车库、厕所和绕组的通道 通往下楼梯平台的楼梯。实木地板。

楼下衣帽间2m x 0.9m

楼梯和卫生间下方 具有足够净空的洗手盆。软木效果地板。提取器 扇子。安装式货架。



下部平台1.5m x 3.8米的地毯。带有双门的大橱柜,配有架子和悬挂栏杆。
通往主卧室的门通道 和通往下一层楼的楼梯。

主卧4.9m x 5.5米

这一铺有地毯的大面积区域有两扇大长窗户,可以欣赏克莱德湾(Firth of Clyde)和伦敦山(hills)的美景 对岸。房间里还有一扇侧窗 明亮的。从这里通过门进入步入式更衣室 面积。

更衣室3.85m x 2.2m

有搁板和悬挂的栏杆,并有足够的空间放置其他物品 存储通过门进入套房浴室。提取器 风扇。

套房2m x 3.1m


尺寸1100mm x 800mm,镀铬毛巾架、坐浴盆、卫生间和洗手盆 嵌入安装好的橱柜中。隐私玻璃窗和提取器 风扇。

主平台2.4m x 3.4m

地板。带Velux顶灯的高天花板。进入厨房, 杂物房和卧室/书房。

卧室/书房4.1m x 4.2m

这个房间目前用作书房,是一间宽敞的双人卧室。大衣橱。阁楼 通道两扇窗户,河上的美景令人惊叹。实木 地板。

厨房4.6m x 3.5m

从主楼梯平台上的双开门,通向这个明亮的 宽敞的现代化厨房,配有大量储物空间和台面, 一些餐厅提供通往就餐区的服务通道。双层窗,平铺的 防溅罩和滚刀抽气罩。实木地板。访问 餐厅和日光室/家庭室/办公室。

面积4.6m x 4.3m

除玻璃外的单扇窗户 法式门,通向一个有警卫的小阳台,阳台上有美丽的大海 意见。坚固的木质地板从厨房一直延伸到这个房间 明亮的餐厅。

日光室/家庭室/办公室3.1m x 4.3m

目前用作办公室,该房间侧面有一扇窗户,后面有两扇窗户,以及 天井门,提供通往甲板的通道。这里阳光明媚 房间采用实木地板。

1.65米x 3.05m

工作台,带不锈钢水槽和瓷砖防溅板。固定货架。洗衣机的房间。现代PVCu 有通往装饰和花园的后门。从窗户到花园。

上层平台2.7m x 2.3m

安装的橱柜和通往休息室、卧室和浴室的通道。

巴特罗