substr

PHP 4, PHP 5, PHP 7, PHP 8
substr - Return part of a string
Substr Online Tool
Manual
Code Examples

Example #1 substr casting behaviour

Result: 1) 'pe' 2) '54' 3) 'gr' 4) '1' 5) '' 6) '' 7) '1200'
PHP Version:

Example #2

Result: string(0) "" ]
PHP Version:

Example #3 Basic substr usage

PHP Version:


Example #4 of substr

PHP Version:


Function substr:

Strings Functions

Most used PHP functions