Verificação de strings em PHP
str_starts_withstr_ends_withstr_containsЗадание 1
Dada a string:
php<?php
$str = 'document.pdf';
?>
Verifique se a string termina com '.pdf'.
Задание 2
Dada a string:
php<?php
$str = 'https://example.com';
?>
Verifique se a string começa com 'https://'.
Задание 3
Dada a string:
php<?php
$str = 'The quick brown fox';
?>
Verifique se a string contém a substring 'fox'.
Задание 4
Dada a string:
php<?php
$str = 'image.png';
?>
Verifique se a string termina com '.png' ou '.jpg'.
Задание 5
Dada a string:
php<?php
$str = 'admin@example.com';
?>
Verifique se a string contém o caractere '@' e termina com '.com'.