1
I have a pre-defined numbering, for example from 1 to 4.
Now I need him to show the numbers that are not being used, which would be:
Números não usados: 2,4
I started the code like this:
<?php
$numeros_sorteio="1,2,3,4";
$numeros_usados="1,3";
echo "numeros livres: 2,4";
?>
Could someone give me some guidance on how to continue?
What is this little bit of PHP you know? With it, you’ve managed to at least try something?
– Woss
By the way, welcome to the site. Seek to do the [tour], access [help] and read the guide of [Ask] to orient yourself with the basics of the operation of the site. If you have any doubt, you can attend the [meta].
– Woss
Hello I apologize to the colleagues if I asked wrong I kindly do not deny me edit the question if it is the case I’m starting now thousand apologies there fixing the question
– kibarco net
The will :D All actions here on the site are reversible. The negative vote is only one way to show that there is something wrong with your question, so much so that the description on the button is "this question shows no research effort; it is not clear or not useful". You can edit it and if you stay within the standards, who voted negatively can review the vote, withdrawing the negative vote and even giving the positive.
– Woss
Thanks understood let’s go edit there will be cool I say clearer ?
– kibarco net
I’ll give you the logic to study: create a
array
with the numbers listed and the other with free, then you must go through thisarray
with afor
and compare one with the other using aif
. Note: In PHP there is a comparison of==
(equal) and===
(identical), for example:1 == "1"
, This means that the values are equal, but not identical (see that they are of different types), already1 === 1
are equal and identical.– bruno101