Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Apply Safe Execution Patterns | Validation Flows and Safe Execution Patterns
PHP Error Handling and Exceptions
Seção 3. Capítulo 4
single

single

bookChallenge: Apply Safe Execution Patterns

Deslize para mostrar o menu

Tarefa

Swipe to start coding

Refactor the divideNumbers function to use safe execution patterns for division in PHP.

  • Validate that both numerator and denominator are numbers.
  • If either argument is not a number, throw an InvalidArgumentException.
  • If denominator is zero, throw a DivisionByZeroError.
  • If validation passes, return the result of dividing numerator by denominator.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 4
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

some-alt