Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalizando desafio 2 #162

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion challenges/0-hello-world/php/Fernandfmsf/helloworld.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?php
echo 'Hello, World!';
echo 'Hello, World';
1 change: 1 addition & 0 deletions challenges/1-cubo-simples/php/Fernandafmsf/cubosimples.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
$number= $argv;

//funcao para percorrer todo o array. Definir a var $i como 1 é imprescindivel para o codigo funcionar, visto que $argv[0] é uma string (nome do projeto)
//count -> tamanho do array
function calcularCubo($number)
{
for($i=1; $i<count($number); $i++){
Expand Down
22 changes: 22 additions & 0 deletions challenges/2-palindromos/php/Fernandafmsf/README.md
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
```
18 changes: 18 additions & 0 deletions challenges/2-palindromos/php/Fernandafmsf/palindromo.php
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);
Loading