🌐
PHP
php.net › manual › en › function.substr.php
PHP: substr - Manual
The results were: (substr) 3.24 (direct access) 11.49 (strstr) 4.96 (With standard deviations 0.01, 0.02 and 0.04) THEREFORE substr is the fastest of the three methods for getting the first few letters of a string. ... If you want to have a string BETWEEN two strings, just use this function: <?php function get_between($input, $start, $end) { $substr = substr($input, strlen($start)+strpos($input, $start), (strlen($input) - strpos($input, $end))*(-1)); return $substr; } //Example: $string = "123456789"; $a = "12"; $b = "9"; echo get_between($string, $a, $b); //Output: //345678 ?>
🌐
W3Schools
w3schools.com › pHp › func_string_substr.asp
PHP substr() Function
<?php echo substr("Hello world",6); ?> Try it Yourself » · The substr() function returns a part of a string.
🌐
ReqBin
reqbin.com › code › php › dw18m9ui › php-substr-example
How to get a substring from a string in PHP?
January 10, 2023 - To get a substring from a string in PHP, you can use the built-in substr($string, $offset, $length) function. The $offset indicates the position at which substr() starts extracting the substring, and the optional $length parameter specifies ...
🌐
GeeksforGeeks
geeksforgeeks.org › php › php-substr-function
PHP substr() function - GeeksforGeeks
June 22, 2023 - The substr() is a built-in function in PHP that is used to extract a part of string.
🌐
Codecademy
codecademy.com › docs › php › string functions › substr()
PHP | String Functions | substr() | Codecademy
July 17, 2023 - The substr() function returns a portion of a string specified by parameters for offset and length.
🌐
YouTube
youtube.com › daniel wood
PHP & MySQL Tutorial 20 - Substring (substr) function - YouTube
Sample code: http://codemahal.com/video/php-string-functions-substr/
Published: February 16, 2016
Views: 2K
Find elsewhere
🌐
W3Schools
www-db.deis.unibo.it › courses › TW › DOCS › w3schools › php › func_string_substr.asp.html
PHP substr() Function
<?php echo substr("Hello world",10)."<br>"; echo substr("Hello world",1)."<br>"; echo substr("Hello world",3)."<br>"; echo substr("Hello world",7)."<br>"; echo substr("Hello world",-1)."<br>"; echo substr("Hello world",-10)."<br>"; echo substr("Hello world",-8)."<br>"; echo substr("Hello world",-4)."<br>"; ?> Run example »
🌐
Scaler
scaler.com › home › topics › php substr() function
PHP substr() Function - Scaler Topics
March 20, 2024 - In PHP, substr() is a built-in function used to extract a portion of a string. It enables developers to retrieve a specific substring based on starting and optionally ending positions. The function takes the original string and the desired start position as arguments, and can also take an optional ...
🌐
ServerAvatar
serveravatar.com › home › blog › how to use php substr function easily
How to Use php substr Function Easily | ServerAvatar
September 24, 2025 - Learn how php substr works with simple examples to cut strings precisely. A quick and easy guide for both beginners and experienced developers.
🌐
Pi My Life Up
pimylifeup.com › home › how to use the substr() function in php
How to use the substr() Function in PHP - Pi My Life Up
May 15, 2022 - In this tutorial, you will learn how to use PHP's substr() function. This function allows you to take a string and only return part of it.
🌐
Simplilearn
simplilearn.com › home › resources › software development › substr in php: an ultimate guide to substr() function
substr in PHP: An Ultimate Guide to substr() Function
September 14, 2025 - The substr in PHP is a built-in function that returns a part of the given string. Learn ✅ syntax ✅ parameter values and their uses with examples. Start now!
Address: 5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
Medium
medium.com › @ok4304571 › php-string-substr-function-0704b10c1327
PHP String substr() Function - Ok - Medium
November 6, 2025 - The substr() is a built-in function of PHP, which is used to extract a part of a string. The substr() function returns a part of a string specified by the start and length parameter.
🌐
Schoolsofweb
schoolsofweb.com › home › all about php › php function list › php string functions › php substr() function
PHP substr() Function – Schools of Web
"&lt;br />"; // s echo substr("substr function", 7, 10) . "&lt;br />"; // function echo substr("substr function", 3, 0) . "&lt;br />"; // echo substr("substr function", 3, NULL) . "&lt;br />"; // str function ?> ... One of the most frequently used built-in PHP string functions.
🌐
Agunechemba
agunechemba.name.ng › 2020 › 08 › 04 › Understanding-PHP-s-substr()-Function.html
Understanding PHP’s substr() Function: The String Surgeon with a Sense of Precision | Agunechemba
August 4, 2020 - The $offset tells PHP where to ____ slicing. The $length parameter is ____, meaning you can safely omit it. If $length is omitted, substr() goes from $offset to the ____ of the string.
🌐
Phpoc
phpoc.com › support › manual › phpoc_internal_functions › contents.php
substr_replace()
<?php $str = "Hello PHPoC!"; $ret = substr_replace($str, "Hi", 0, 5); echo "$ret\r\n"; // OUTPUT: Hi PHPoC! $ret = substr_replace($str, "Hi", -12, 5); echo "$ret\r\n"; // OUTPUT: Hi PHPoC! $ret = substr_replace($str, "Hi", 0, -7); echo "$ret\r\n"; // OUTPUT: Hi PHPoC!