PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function validate($value): void { preg_match_all('/<([a-zA-Z0-9]+)(\s[^>]*)?>/i', $value, $matches); $invalidTags = array_filter($matches[1], fn($tag) => !in_array(strtolower($tag), $this->allowed)); $invalidTags = array_filter($matches[1], fn ($tag) => !in_array(strtolower($tag), $this->allowed)); if (!empty($invalidTags)) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $value) ->addViolation(); } } validate('lkdsjkfj <br /> dflkjdfkl <br>')
Show:  
Copy Clear