Estrazione di stringhe in PHP
substrmb_substrmb_strcutЗадание 1
Data la stringa:
php<?php
$str = 'html css php';
?>
Estrarre dalla nostra stringa e visualizzare a schermo:
php'html'
'css'
'php'
Задание 2
Data la stringa:
php<?php
$str = 'abcdefgh';
?>
Visualizza gli ultimi 3 caratteri:
php'fgh'
Задание 3
Data la stringa:
php<?php
$str = 'http://example.com';
?>
Verifica che inizi con 'http://':
Задание 4
Data la stringa:
php<?php
$str = 'https://example.com';
?>
Verifica che inizi con 'http://' o 'https://':
Задание 5
Data la stringa:
php<?php
$str = 'image.png';
?>
Verifica che termini con '.png':
Задание 6
Data la stringa:
php<?php
$str = 'photo.jpg';
?>
Verifica che termini con '.png' o '.jpg':
Задание 7
Data la stringa:
php<?php
$str = 'This is a long string';
?>
Se i caratteri sono più di 5, visualizza i primi 5 con i puntini di sospensione, altrimenti l'intera stringa:
php'This ...'
Задание 8
Data la stringa:
php<?php
$str = 'многобайтовые строки требуют особого подхода';
?>
Estrai l'ultima parola:
php'подхода'
Задание 9
Data la stringa:
php<?php
$str = 'пример работы с кириллическими символами';
?>
Estrai e visualizza:
php'работы'
'кириллическими'