Respuesta: problema con concatenar $archivo = file("datos.txt");
$lineas = count($archivo);
$clientes = array();
for($i=0; $i < $lineas; $i++)
{
$cadena=$archivo[$i];
if(empty($cadena))
{
continue;
}
$cad1 = ltrim(rtrim(substr($cadena, 0, 10)));
$nroped = ltrim(rtrim(substr($cadena, 10, 10)));
$codcli = ltrim(rtrim(substr($cadena, 20, 15)));
$descli = ltrim(rtrim(substr($cadena, 35, 60)));
$dirdesp = ltrim(rtrim(substr($cadena, 86, 39)));
$distdesp = ltrim(rtrim(substr($cadena, 155, 40)));
$provdesp = ltrim(rtrim(substr($cadena, 195, 40)));
$depdesp = ltrim(rtrim(substr($cadena, 235, 40)));
$codart = ltrim(rtrim(substr($cadena, 275, 20)));
$bulto = ltrim(rtrim(substr($cadena, 296, 14)));
$cubicaje = ltrim(rtrim(substr($cadena, 309, 20)));
//$peso = ltrim(rtrim(substr($cadena, 324, 14)));
$peso = ltrim(rtrim(substr($cadena, 323, 14)));
if(isset($clientes[$cad1]))
{
$clientes[$cad1] = array(
'nroped' => $nroped,
'codcli' => $codcli,
'descli' => $descli,
'dirdesp' => $dirdesp,
'distdesp' => $distdesp,
'provdesp' => $provdesp,
'depdesp' => $depdesp,
'codart' => $codart,
'bulto' => $bulto + $clientes[$cad1]['bulto'],
'cubicaje' => $cubicaje + $clientes[$cad1]['cubicaje'],
'peso' => $peso + $clientes[$cad1]['peso']);
}
else
{
$clientes[$cad1] = array(
'nroped' => $nroped,
'codcli' => $codcli,
'descli' => $descli,
'dirdesp' => $dirdesp,
'distdesp' => $distdesp,
'provdesp' => $provdesp,
'depdesp' => $depdesp,
'codart' => $codart,
'bulto' => $bulto,
'cubicaje' => $cubicaje,
'peso' => $peso);
}
}
?>
<?php
foreach($clientes as $id => $datos) {
$idsuccli=$datos['codcli'];
?>
<tr>
<td height="24"><div align="center">
?>
///////////////aqui empieza
$texto = "";
$texto .= $idsuccli;
echo '"'.$texto.'"';
$input=explode(" ",'$texto');
$result = array_unique($input);
foreach ($result as $w=>$c){
//echo $c." ";
}
} |