Gracias,
yusneerqui.
Creo que no me expliqué bien. La función pertenece a JS. Y ya he utilizado otras veces algo semejante. La función completa es así.
Código PHP:
<script>
function HazArrayM_txt()
{
var l;
datosM = []; // Vaciamos el array
<?php
if (file_exists('XX/Prueba.txt'))
{
$fp = fopen('XX/Prueba.txt', 'r');
while (!feof($fp))
{
$linea = fgets($fp);
$l = strlen($linea);
if ($l > 17)
$linea = substr($linea, 0, 16);
{
?>
l = <?php echo $linea;?>
//datosM.push(l);
alert(l);
<?php
}
}
fclose($fp);
}// if
?>
}; // fin HazArrayM
</script>
Saludos.