delete code in string with loop when read PDF with php

I´m traying to read PDF file with this library, SmalotPdfParserParser(); in laravel 5.6

i´m reading all my pdf ok, i´m getting all my content ok. i´m deleting headers from my PDF and i´m inserting by line in array.

and this it´s data:

    [0] =>  MARTIN CARRILLO MARIA ESMERALDA ALHAMBRA 10 958 54 38 93
[1] => 1745591 ESPIGARES DIAS JOSE ANTONIO ALHAMBRA 11 958 54 33 32
[2] => 1770062 GUTIERREZ TITOS JOSE MANUEL ALHAMBRA 12 958 54 04 10
[3] => 1793228 MARTIN COBOS ANTONIO ALHAMBRA 18 958 54 33 28
[4] => 1768807 GOMEZ CARRILLO JOSE ALHAMBRA 20 958 54 32 72
[5] => 1830072 RODRIGUEZ RUANO BUENAVENTURA ALHAMBRA 21 958 54 35 86
[6] => 1759534 GARCIA ARIAS MARIA ISABEL ALHAMBRA 22 958 54 07 87
[7] => 1831938 RODRIGUEZ JIMENEZ MIGUEL ALHAMBRA 27 958 54 08 77
[8] => 1722022 GUTIERREZ FERNANDEZ AMANDA HILDA ALHAMBRA 3 958 49 98 62
[9] => 1746872 DIAZ FLORIAN DOLORES ALHAMBRA 30 958 54 33 99
[10] => 1817587 PEREZ LASTRA SAUL ADAN ALHAMBRA 32 958 54 31 46
[11] => 1724006 AMIGO MOLINA MARIA MATILDE ALHAMBRA 35 958 54 31 91
[12] => 1745604 ESPIGARES GOMEZ JORGE ALHAMBRA 37 958 54 02 22
[13] => 1745595 ESPIGARES ESPIGARES JOSE ALHAMBRA 40 958 54 31 83

i need delete firt numbers, it´s code from this client. i´m doing this for delete code, but always it´s doing in firts element.

This is my code to tray delete my code from all string…

// loop to get data line
for($i=0; $i<count($dataByLine); $i++){
// delete code
$numberCode = stripos($dataByLine[$i], " ");
$codeClear = substr($text, 0, $numberCode);
$dataByLine = str_replace($codeClear, "", $dataByLine);

print_r($dataByLine);
}

this print_r() it´s my first content array. As you can see in my array, first element it´s without code.. but the rest, have code.

how i can to delete all code from this string¿?

thanks for help and read. Sorry for my english

updated

// loop to get data line
foreach($dataByLine as &$line){
//$line = preg_replace('/^[d]+/','',$line);
$line = ltrim($line,"0123456789");

array_push($dataList, $line);
}

print_r($dataList);

this it´s result:

    [0] =>  1794707 MARTIN CARRILLO MARIA ESMERALDA ALHAMBRA 10 958 54 38 93
[1] => ESPIGARES DIAS JOSE ANTONIO ALHAMBRA 11 958 54 33 32
[2] => GUTIERREZ TITOS JOSE MANUEL ALHAMBRA 12 958 54 04 10
[3] => MARTIN COBOS ANTONIO ALHAMBRA 18 958 54 33 28
[4] => GOMEZ CARRILLO JOSE ALHAMBRA 20 958 54 32 72
[5] => RODRIGUEZ RUANO BUENAVENTURA ALHAMBRA 21 958 54 35 86
[6] => GARCIA ARIAS MARIA ISABEL ALHAMBRA 22 958 54 07 87
[7] => RODRIGUEZ JIMENEZ MIGUEL ALHAMBRA 27 958 54 08 77
[8] => GUTIERREZ FERNANDEZ AMANDA HILDA ALHAMBRA 3 958 49 98 62
[9] => DIAZ FLORIAN DOLORES ALHAMBRA 30 958 54 33 99

from Newest questions tagged laravel-5 – Stack Overflow https://ift.tt/3BSpCW4
via IFTTT

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.