Select certain input value

0

I'm finalizing a project, whereby the user bip (barcode reader) in an input the barcode of an invoice and need only return the invoice number (9 positions) in another input.

The key position is 44 characters. I need to select from character 25 to 34 to get the note number. Can you help me? hug

    
asked by anonymous 08.04.2018 / 16:45

1 answer

0

You can use the substr() function:

$codigo = "01234567890123456789012345678901234567890123";
$nota = substr($codigo, 24, 9);

The first parameter you pass the variable, in the second the initial position (position 0 = 1 ° character, position 24 = 25 ° character) and in the third, how many characters from the initial

    
08.04.2018 / 18:34