String Uitsny in PHP
Gegee 'n string:
<?php
$str = 'html css php';
?>
Sny uit ons string en vertoon op die skerm:
'html'
'css'
'php'
Gegee 'n string:
<?php
$str = 'abcdefgh';
?>
Vertoon die laaste 3 karakters:
'fgh'
Gegee 'n string:
<?php
$str = 'http://example.com';
?>
Gaan na of dit begin met 'http://':
Gegee 'n string:
<?php
$str = 'https://example.com';
?>
Gaan na of dit begin met 'http://' of 'https://':
Gegee 'n string:
<?php
$str = 'image.png';
?>
Gaan na of dit eindig met '.png':
Gegee 'n string:
<?php
$str = 'photo.jpg';
?>
Gaan na of dit eindig met '.png' of '.jpg':
Gegee 'n string:
<?php
$str = 'This is a long string';
?>
As daar meer as 5 karakters is, vertoon die eerste 5 met drie kolletjies, anders die hele string:
'This ...'
Gegee 'n string:
<?php
$str = 'многобайтовые строки требуют особого подхода';
?>
Sny die laaste woord uit:
'подхода'
Gegee 'n string:
<?php
$str = 'пример работы с кириллическими символами';
?>
Sny uit en vertoon:
'работы'
'кириллическими'