-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #162 from Fernandafmsf/challenges/2-palindromo/php…
…/Fernandafmsf Finalizando desafio 2
- Loading branch information
Showing
4 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<?php | ||
echo 'Hello, World!'; | ||
echo 'Hello, World'; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Submissão de Exercicio | ||
|
||
**Exercicio:** 2 - Palindromos | ||
|
||
**Nickname:** Fernandafmsf | ||
|
||
**Nível Técnico:** - Estudante - | ||
|
||
**Empresa:** - Nenhuma - | ||
|
||
**Twitter**: https://twitter.com/dev_fernanda | ||
|
||
**Dificuldade de Resolução:** - Baixa - | ||
|
||
**Comentários:** Foi bom conhecer funçoes como strrev, que reverte as palavras e strtolower, que retorna a string com todos os caracteres em minuscolo | ||
|
||
**Como rodar o desafio**: | ||
|
||
Use o comando abaixo: | ||
```bash | ||
php palindromo.php argv1 argv2 argv3 | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
$words=$argv; | ||
function verifyPalindrome($word) | ||
{ | ||
|
||
for($i=1;$i<count($word);$i++){ | ||
|
||
$word[$i] = strtolower($word[$i]); //transformando letras maiusculas em minusculas | ||
if(strrev($word[$i]) != $word[$i]){ | ||
echo "false" . PHP_EOL; | ||
}else{ | ||
echo "true".PHP_EOL; | ||
} | ||
|
||
} | ||
} | ||
|
||
verifyPalindrome($words); |