String Checking in PHP
Given a string:
<?php
$str = 'document.pdf';
?>
Check if the string ends with '.pdf'.
Given a string:
<?php
$str = 'https://example.com';
?>
Check if the string starts with 'https://'.
Given a string:
<?php
$str = 'The quick brown fox';
?>
Check if the string contains the substring 'fox'.
Given a string:
<?php
$str = 'image.png';
?>
Check if the string ends with '.png' or '.jpg'.
Given a string:
<?php
$str = 'admin@example.com';
?>
Check if the string contains the character '@' and ends with '.com'.