Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Strip HTML and PHP tags from a string
<?php strip_tags(string $string, array|string|null $allowed_tags = null): string
<?php public function alert($string, $verbosity = null)
{
$length = Str::length(strip_tags($string)) + 12;
$this->comment(str_repeat('*', $length), $verbosity);
$this->comment('* '.$string.' *', $verbosity);
<?php ];
});
$this->output->writeln(strip_tags(json_encode($output)));
}
<?php protected function parseChoice($choice)
{
[$type, $value] = explode(': ', strip_tags($choice));
if ($type === 'Provider') {
$this->provider = $value;
<?php public function stripTags($allowedTags = null)
{
return new static(strip_tags($this->value, $allowedTags));
}
<?php {
$value = $escape ? e($value) : $value;
PHPUnit::assertStringContainsString((string) $value, strip_tags($this->rendered));
return $this;
}
<?php {
$values = $escape ? array_map('e', $values) : $values;
PHPUnit::assertThat($values, new SeeInOrder(strip_tags($this->rendered)));
return $this;
}
<?php {
$value = $escape ? e($value) : $value;
PHPUnit::assertStringNotContainsString((string) $value, strip_tags($this->rendered));
return $this;
}
<?php $values = $escape ? array_map('e', $value) : $value;
$content = strip_tags($this->getContent());
foreach ($values as $value) {
PHPUnit::assertStringContainsString((string) $value, $content);
<?php {
$values = $escape ? array_map('e', $values) : $values;
PHPUnit::assertThat($values, new SeeInOrder(strip_tags($this->getContent())));
return $this;
}
<?php $values = $escape ? array_map('e', $value) : $value;
$content = strip_tags($this->getContent());
foreach ($values as $value) {
PHPUnit::assertStringNotContainsString((string) $value, $content);
<?php {
$value = $escape ? e($value) : $value;
PHPUnit::assertStringContainsString((string) $value, strip_tags($this->rendered));
return $this;
}
<?php {
$values = $escape ? array_map('e', $values) : $values;
PHPUnit::assertThat($values, new SeeInOrder(strip_tags($this->rendered)));
return $this;
}
<?php {
$value = $escape ? e($value) : $value;
PHPUnit::assertStringNotContainsString((string) $value, strip_tags($this->rendered));
return $this;
}
<?php $this->assertSame('...ayl...', Str::excerpt('taylor', 'Y', ['radius' => 1]));
$this->assertSame('<div> The article description </div>', Str::excerpt('<div> The article description </div>', 'article'));
$this->assertSame('...The article desc...', Str::excerpt('<div> The article description </div>', 'article', ['radius' => 5]));
$this->assertSame('The article description', Str::excerpt(strip_tags('<div> The article description </div>'), 'article'));
$this->assertSame('', Str::excerpt(null));
$this->assertSame('', Str::excerpt(''));
$this->assertSame('', Str::excerpt(null, ''));