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、230が表示されます。
- str_replaceを使用して、スペースをntgで置き換えますが、まだ機能していません。stlenは、空の値に対して22、28などを表示しています。
- 私はトリムbtを使用していません。
データのstrlenが22以上である理由について誰かが私を助けてくれますか?そして、これらのタイプの要素を配列から削除する方法は?