我有一个使用 DOM 从 html 中提取的数组。现在如下面的数组所示,有很多我不想要的空数据。所以无论我尝试从数组中删除空值,它都没有被删除。
Array ( [0] => [1] => Outpost Congratulations13 [2] => [3] => [4] => [5] => [6] =>
[7] => Yard will reflect the type of work that they do and the strength and variety of their membership, from recent graduates to emerging and mid-career artists.
[8] => [9] => [10] => [11] => Gallery Closed Good Friday, open Bank Holiday Monday. Admission Free
[12] => [13] => K Yard, Castle Street
[14] => [15] => Friday 1 Mar 3 [16] => [17] => [18] => [19] => www.somesite.co.uk
[20] => [21] => [22] => [23] => Map [24] => [25] => Contact the Organiser Tell a Friend about this Event [26] => [27] => Plan Your Journey [28] => [29] => [30] => )
我所尝试的一切:-
- array_filter :它没有工作。
- 许多检查值是否为空的功能仍然不起作用。
- 我尝试使用 strlen 查找空字符串的长度,但它显示 22, 2 30 作为长度。
- 我使用 str_replace 将空格替换为 ntg 仍然 nt 工作,并且 stlen 显示 22、28 等用于空值。
- 我用过trim bt没用...
任何人都可以帮助我了解为什么数据的 strlen 为 22 或更多。以及如何从数组中删除这些类型的元素???