Imagem de fundo

Considerando a execução do trecho de código...

Considerando a execução do trecho de código abaixo:


-<?php

-class Email {

private string $val;


---public function _construct(string $val) {

----if (filter var($val, FILTER VALIDATE EMAIL) === false) {

------throw new \InvalidArgumentException('Endereço de e-mail

-inválido');

-----}

-----$this->val = $val;

---}


---public function toStringO: string {

----return $this->val;

---}

-}


-$email = new Email ('[email protected]');

-var dump((string) $email) ;


O valor retomado será;


B

string(16) "[email protected]"


C

""


D

PHP Fatal error: Uncaught InvalidArgumentException: Endereço de e-mail inválido in .\index.php


E

object(Email)#1 (l) {

["val":"Email":private]=>

string(16) "[email protected]"

}