7
Good morning, everybody, all right? I have the code that prints the different values found in 2 arrays and these values are saved in the different variable ($different) I need to know how to print these values saved in different but stating which array it belongs to:
$a = [1,2,3,4,5];
$b = [2,4,6,7];
$diferentes = 1, 3, 5, 7
I need to print:
$a = 1,3,5
$b = 7
I tried to use array_diff
but unsuccessfully.
$diff1 = array_diff($diferentes, $a);
$diff2 = array_diff($diferentes, $b);
Thanks in advance.
So, but I need to take the $different variable and know what numbers are in it from their respective arrays.
– Gustavo Freire
I managed, as you said, was complicating simple thing! Thank you very much Bacco
– Gustavo Freire
Need, dispose. It is as a suggestion in the next questions you put how you will use the data. Then we may be able to help better.
– Bacco
Next time I put the code I made and the data I have, for greater understanding! Hugção
– Gustavo Freire
@Gustavofreire recommend passing the acceptance to another answer.
– Bacco
Bacco, sorry to bother you! I wonder if I can make an exe of this code, where $a would be Credit and $b would be Debito, for one to enter values in each one, then have it executed and printed in one . txt the result. Thank you
– Gustavo Freire
@Gustavofreire you can run PHP through the console, (path where php is installed)/php.exe meuscript.php
– Bacco
Good morning Bacco, rodo pelo ideone.com , what I would like to know, é uma luz de como poderia estar fazendo uma interface para usuario, onde ele entre com Valores de Credito e Valores de Debito, e o codigo php faria a comparação. Thank you for your attention
– Gustavo Freire
Let’s go continue this discussion in chat.
– Gustavo Freire