String Kontrole in PHP
Gegee 'n string:
<?php
$str = 'document.pdf';
?>
Kontroleer of die string eindig met '.pdf'.
Gegee 'n string:
<?php
$str = 'https://example.com';
?>
Kontroleer of die string begin met 'https://'.
Gegee 'n string:
<?php
$str = 'The quick brown fox';
?>
Kontroleer of die string die substring 'fox' bevat.
Gegee 'n string:
<?php
$str = 'image.png';
?>
Kontroleer of die string eindig met '.png' of '.jpg'.
Gegee 'n string:
<?php
$str = 'admin@example.com';
?>
Kontroleer of die string die karakter '@' bevat en eindig met '.com'.