├── README.md ├── .gitattributes ├── ex001 └── index.php ├── desafios ├── desafio01 │ ├── index.php │ └── desafio1.php ├── desafio03 │ ├── index.php │ └── conversao.php └── desafio02 │ └── index.php ├── ex000 └── index.php ├── formularios ├── index.html ├── cad.php └── assets │ └── style.css ├── ex004 └── index.php ├── strings └── index.php ├── LICENSE ├── ex002 └── index.php ├── ex003 └── index.php └── operadores_aritmeticos └── index.php /README.md: -------------------------------------------------------------------------------- 1 | # cursophp 2 | Curso de php 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /ex001/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dados do servidor 7 | 8 | 9 |

Dados do servidor

10 | 11 | 14 | 15 | -------------------------------------------------------------------------------- /desafios/desafio01/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Desafio 01 7 | 8 | 9 |
10 | 11 | 12 | 13 |
14 | 15 | -------------------------------------------------------------------------------- /desafios/desafio03/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 |
10 | 11 | 12 | 13 |
14 | 15 | -------------------------------------------------------------------------------- /ex000/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Primneiro programa em php 7 | 8 | 9 |

10 | 16 | 20 |

21 |

Vamos nos livrar da maldição

22 | 23 | -------------------------------------------------------------------------------- /formularios/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Fomrmulários 7 | 8 | 9 | 10 |
11 |

Apresente-se para nós

12 |
13 |
14 |
15 | 16 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | -------------------------------------------------------------------------------- /desafios/desafio01/desafio1.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Desafio 01 - 2° página 7 | 8 | 9 |

10 | O número escolhido foi: $numDoInput


"; 15 | echo "

O seu antecessor é: $antecessor


"; 16 | echo "

O seu sucessor é: $sucessor

"; 17 | ?> 18 |

19 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /ex004/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Tipos de dados primitivos 7 | 8 | 9 | 28 | 29 | -------------------------------------------------------------------------------- /strings/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Tipos de string 7 | 8 | 9 | 20 | 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 eliasAlvs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /formularios/cad.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Resultado 7 | 8 | 9 |
10 |

Resultado do processamento de dados

11 |
12 |
13 | É um prazer te conhecer, $nome $sobrenome! "; 28 | ?> 29 |
30 | 31 | -------------------------------------------------------------------------------- /desafios/desafio02/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Sorteador de números. 7 | 8 | 9 | "; 17 | echo "Número gerado é $randomNumber
"; 18 | ?> 19 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /ex002/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PHP 7 | 8 | 9 |

Exemplo de PHP

10 | 40 | 41 | -------------------------------------------------------------------------------- /desafios/desafio03/conversao.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Conversor de moeda 7 | 8 | 9 | 15 |

16 | \ 19 | Para limitar o número de casas decimais que vão ser exibidas e definir os separadores de milhares e decimais, podemos usar a função nativa do PHP number_format($variavel, n°_de_casas_decimais, "separador_decimal", "separador_milhar") 20 | */ 21 | //echo"Seus R$" . number_format($valorOferecido, 3, ",", ".") . " equivalem a US$" . number_format($valorDolar, 2, ",", "."); 22 | 23 | //Formatação de moedas com internacionalização ---- pt_BR vem da biblioteca intl 24 | $padrao = numfmt_create("pt_BR", NumberFormatter::CURRENCY); 25 | echo "Seus " . numfmt_format_currency($padrao, $valorOferecido, "BRL") . " equivalem a " . numfmt_format_currency($padrao, $valorDolar, "USD"); 26 | ?> 27 |

28 | 29 | 30 | -------------------------------------------------------------------------------- /ex003/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Variáveis e constantes 7 | 8 | 9 | 34 | 35 | -------------------------------------------------------------------------------- /operadores_aritmeticos/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Operadores Aritméticos 7 | 8 | 9 | 47 | 48 | -------------------------------------------------------------------------------- /formularios/assets/style.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | 3 | * { 4 | font-family: Verdana, Geneva, Tahoma, sans-serif; 5 | box-sizing: border-box; 6 | } 7 | 8 | /* ELEMENTOS DA INTERFACE */ 9 | 10 | body { 11 | background-color: #15142b; 12 | background-image: linear-gradient(180deg, #372991, #15142b); 13 | background-repeat: no-repeat; 14 | background-position: center center; 15 | background-size: cover; 16 | background-attachment: fixed; 17 | 18 | display: flex; 19 | flex-direction: column; 20 | flex-wrap: nowrap; 21 | justify-content: center; 22 | align-items: center; 23 | } 24 | 25 | header, main, section, article { 26 | max-width: 700px; 27 | } 28 | 29 | header > h1 { 30 | color: white; 31 | text-shadow: 3px 3px 0px black; 32 | } 33 | 34 | main, section, article { 35 | background-color: white; 36 | padding: 15px; 37 | margin-bottom: 20px; 38 | border-radius: 10px; 39 | box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.502); 40 | } 41 | 42 | footer { 43 | display: block; 44 | width: 100vw; 45 | background-color: #291f6c; 46 | color: white; 47 | text-align: center; 48 | margin-top: auto; 49 | padding: 5px; 50 | } 51 | 52 | p { 53 | text-align: justify; 54 | line-height: 1.5em; 55 | } 56 | 57 | h2, h3, h4 { 58 | color: #372991; 59 | margin: 0 0 10px 0; 60 | } 61 | 62 | a { 63 | color: #15142b; 64 | background-color: rgba(55, 41, 145, 0.1); 65 | padding: 0 3px; 66 | font-weight: 600; 67 | text-decoration: none; 68 | border-bottom: .5px dotted #372991; 69 | } 70 | 71 | a:hover { 72 | color: #372991; 73 | border-bottom: 1px solid #372991; 74 | } 75 | 76 | /* TABELAS E LISTAS */ 77 | 78 | table { 79 | min-width: 400px; 80 | border-spacing: 0px; 81 | border: 0.5px solid #372991; 82 | margin: 10px auto; 83 | } 84 | 85 | table th { 86 | background-color: #372991; 87 | color: white; 88 | padding: 5px; 89 | text-align: left; 90 | } 91 | 92 | table td { 93 | padding: 5px; 94 | } 95 | 96 | table tr { 97 | background-color: rgba(55, 41, 145, 0.05); 98 | } 99 | 100 | table tr:nth-child(odd) { 101 | background-color: rgba(55, 41, 145, 0.3); 102 | } 103 | 104 | table.divisao { 105 | border: 1px solid white; 106 | } 107 | 108 | table.divisao td { 109 | background-color: white; 110 | padding: 20px; 111 | text-align: center; 112 | font-size: 2.5em; 113 | } 114 | 115 | table.divisao tr:nth-child(1) td:nth-child(2) { 116 | border-bottom: 3px solid black; 117 | border-left: 3px solid black; 118 | } 119 | 120 | table.divisao tr:nth-child(2) td:nth-child(2) { 121 | border-left: 3px solid black; 122 | } 123 | 124 | table.divisao tr:nth-child(2) td:nth-child(1) { 125 | text-decoration: underline; 126 | } 127 | 128 | ul > li::marker { 129 | color: #372991; 130 | } 131 | 132 | /* ELEMENTOS DE FORMULÁRIO */ 133 | 134 | form { 135 | background-color: rgba(55, 41, 145, 0.2); 136 | padding: 15px; 137 | border-radius: 10px; 138 | } 139 | 140 | form label { 141 | display: block; 142 | width: fit-content; 143 | font-size: 0.8em; 144 | font-weight: 100; 145 | background-color: rgba(55, 41, 145, 0.2); 146 | padding: 3px 7px; 147 | margin-top: 10px; 148 | margin-bottom: 0px; 149 | border-radius: 5px; 150 | } 151 | 152 | input[type=text], [type=number], select, input[type=date], input[type=date], input[type=datetime], input[type=email], input[type=month], input[type=password], input[type=range], input[type=tel], input[type=time], input[type=week] { 153 | width: 100%; 154 | padding: 12px 20px; 155 | font-size: 1em; 156 | margin: 8px 0; 157 | display: inline-block; 158 | border: 1px solid #ccc; 159 | border-radius: 4px; 160 | box-sizing: border-box; 161 | } 162 | 163 | input[type=submit] { 164 | width: 100%; 165 | background-color: #4CAF50; 166 | font-size: 1em; 167 | color: white; 168 | padding: 10px 20px; 169 | margin: 5px 0; 170 | border: none; 171 | border-radius: 4px; 172 | cursor: pointer; 173 | } 174 | 175 | input[type=submit]:hover { 176 | background-color: #45a049; 177 | } 178 | 179 | input[type=reset] { 180 | width: 100%; 181 | background-color: #eb9903; 182 | font-size: 1em; 183 | color: white; 184 | padding: 10px 20px; 185 | margin: 5px 0; 186 | border: none; 187 | border-radius: 4px; 188 | cursor: pointer; 189 | } 190 | 191 | input[type=reset]:hover { 192 | background-color: #c27013; 193 | } 194 | 195 | input[type=button], button { 196 | width: 100%; 197 | background-color: #372991; 198 | font-size: 1em; 199 | color: white; 200 | padding: 10px 20px; 201 | margin: 5px 0; 202 | border: none; 203 | border-radius: 4px; 204 | cursor: pointer; 205 | } 206 | 207 | input[type=button]:hover, button:hover { 208 | background-color: #291f6c; 209 | } 210 | 211 | fieldset { 212 | border: 0.5px dotted #372991; 213 | } 214 | 215 | fieldset > legend { 216 | font-size: 0.8em; 217 | font-weight: 100; 218 | background-color: rgba(55, 41, 145, 0.2); 219 | padding: 3px 7px; 220 | border-radius: 5px; 221 | } 222 | 223 | input[type=radio] + label, input[type=checkbox] + label { 224 | display: inline-block; 225 | font-size: 1em; 226 | background-color: rgba(0, 0, 0, 0); 227 | } --------------------------------------------------------------------------------