Created
March 2, 2017 15:45
-
-
Save YurePereira/41b1fba0c5d92cd532ebd34db7816992 to your computer and use it in GitHub Desktop.
Verificando se uma chave existe dentro de um Array em PHP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $listFrults = array( | |
| 'p' => 'Pineapple', | |
| 'c' => 'Cashew', | |
| 'a' => 'Apple', | |
| 'o' => 'Orange' | |
| ); | |
| if (array_key_exists('a', $listFrults)) { | |
| echo 'Chave existente.';//Bloco que será apresentado. | |
| } else { | |
| echo 'Chave não existente.'; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment