Sandbox
PHP Functions
Donate/Get Premium
Login / Register
OnlinePHP
.io
# Execute and compare PHP Online
Sandbox
PHP Functions
Donate/Get Premium
Login / Register
OnlinePHP.io
Documentation
substr
Examples
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'
Example #2
Result:
string(0) "" ]
Example #3 Basic substr usage
Example #4 of substr
Function substr:
Substr Online Tool
Manual
Code Examples
Strings Functions
addcslashes
addslashes
bin2hex
chop
chr
chunk_split
convert_cyr_string
convert_uudecode
convert_uuencode
count_chars
crc32
crypt
echo
explode
fprintf
get_html_translation_table
hebrevc
hebrev
hex2bin
htmlentities
html_entity_decode
htmlspecialchars_decode
htmlspecialchars
implode
join
lcfirst
levenshtein
localeconv
ltrim
md5_file
md5
metaphone
money_format
nl2br
nl_langinfo
number_format
ord
parse_str
printf
print
quoted_printable_decode
quoted_printable_encode
quotemeta
rtrim
setlocale
sha1_file
sha1
similar_text
soundex
sprintf
sscanf
strcasecmp
strchr
strcmp
strcoll
str_contains
strcspn
str_ends_with
str_getcsv
stripcslashes
stripos
stripslashes
strip_tags
str_ireplace
stristr
strlen
strnatcasecmp
strnatcmp
strncasecmp
strncmp
str_pad
strpbrk
strpos
strrchr
str_repeat
str_replace
strrev
strripos
str_rot13
strrpos
str_shuffle
str_split
strspn
str_starts_with
strstr
strtok
strtolower
strtoupper
strtr
str_word_count
substr_compare
substr_count
substr_replace
substr
trim
ucfirst
ucwords
utf8_decode
utf8_encode
vfprintf
vprintf
vsprintf
wordwrap
Most used PHP functions
sandbox
(153499017)
password_hash
(553192)
hash_pbkdf2
(523174)
unserialize
(313826)
serialize
(235163)
preg_replace
(234362)
json_encode
(216677)
preg_match
(208109)
json_decode
(156382)
hex2bin
(137711)
uniqid
(110741)
array
(92150)
iconv
(77682)
preg_match_all
(66520)
password_verify
(62177)
utf8_decode
(60205)