PHP-de setir kesmek
substrmb_substrmb_strcutЗадание 1
Setir berlen:
php<?php
$str = 'html css php';
?>
Setirimizden kesip, ekrana çykaryň:
php'html'
'css'
'php'
Задание 2
Setir berlen:
php<?php
$str = 'abcdefgh';
?>
Soňky 3 nyşany çykaryň:
php'fgh'
Задание 3
Setir berlen:
php<?php
$str = 'http://example.com';
?>
Ol 'http://' bilen başlaýandygyny barlaň:
Задание 4
Setir berlen:
php<?php
$str = 'https://example.com';
?>
Ol 'http://' ýa-da 'https://' bilen başlaýandygyny barlaň:
Задание 5
Setir berlen:
php<?php
$str = 'image.png';
?>
Ol '.png' bilen gutarýandygyny barlaň:
Задание 6
Setir berlen:
php<?php
$str = 'photo.jpg';
?>
Ol '.png' ýa-da '.jpg' bilen gutarýandygyny barlaň:
Задание 7
Setir berlen:
php<?php
$str = 'This is a long string';
?>
Eger nyşan sany 5-den köp bolsa, ilkinji 5 nyşany üç nokat bilen çykaryň, bolmasa setiriňiziň özüni:
php'This ...'
Задание 8
Setir berlen:
php<?php
$str = 'многобайтовые строки требуют особого подхода';
?>
Soňky sözi kesip alyň:
php'подхода'
Задание 9
Setir berlen:
php<?php
$str = 'пример работы с кириллическими символами';
?>
Kesip we çykaryň:
php'работы'
'кириллическими'