No me había fijado, me faltaba reiniciar una variable para que siga generando array:
Código PHP:
Ver original<?php
$y = 1;
$z = 0;
foreach ($f as $l) {
if (strstr($l, 'TerminalFactory find')) { if ($y == 2) {
$z++;
$y = 1;
}
$y++;
} else {
$arr[$z][] = $l;
}
}
echo '<pre>';
echo '</pre>';
Si el contenido del txt es:
Código PHP:
Ver original01/06/2012 00:01:20 - TerminalFactory find (00:00:41:36:02:38)
01/06/2012 00:01:20 - CBIEquipment--equipmentKey: 00:00:41:36:02:38
01/06/2012 00:01:20 - CBIEquipment--equipmentKey: 00:00:41:36:02:38
01/06/2012 00:01:20 - TerminalFactory find (00:00:41:36:02:38)
01/06/2012 00:01:20 - TerminalFactory find (00:00:41:36:02:38)
01/06/2012 00:01:20 - CBIEquipment--equipmentKey: 00:00:41:36:02:38
01/06/2012 00:01:20 - CBIEquipment--equipmentKey: 00:00:41:36:02:38
01/06/2012 00:01:20 - TerminalFactory find (00:00:41:36:02:38)
01/06/2012 00:01:20 - TerminalFactory find (00:00:41:36:02:38)
01/06/2012 00:01:20 - CBIEquipment--equipmentKey: 00:00:41:36:02:38
01/06/2012 00:01:20 - CBIEquipment--equipmentKey: 00:00:41:36:02:38
01/06/2012 00:01:20 - TerminalFactory find (00:00:41:36:02:38)
El resultado es:
Cita: Array
(
[0] => Array
(
[0] => 01/06/2012 00:01:20 - CBIEquipment--equipmentKey: 00:00:41:36:02:38
[1] => 01/06/2012 00:01:20 - CBIEquipment--equipmentKey: 00:00:41:36:02:38
)
[1] => Array
(
[0] => 01/06/2012 00:01:20 - CBIEquipment--equipmentKey: 00:00:41:36:02:38
[1] => 01/06/2012 00:01:20 - CBIEquipment--equipmentKey: 00:00:41:36:02:38
)
[2] => Array
(
[0] => 01/06/2012 00:01:20 - CBIEquipment--equipmentKey: 00:00:41:36:02:38
[1] => 01/06/2012 00:01:20 - CBIEquipment--equipmentKey: 00:00:41:36:02:38
)