AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Php substring12/7/2023 ![]() ![]() If the input string length is less than the length specified or no length is specified, substr() returns Boolean false. The optional parameter ‘length’ can also be positive or negative or nothing. A starting point can be positive or negative a negative starting point is extracting the input string from the end. We have mentioned the starting point to extract the input string. How do the Parameters work in the syntax? Listed out a good number of examples to work on. With this, we conclude ‘PHP substr.’ Introduced to what PHP substr is and its syntax. Var_dump(substr("eduCBA is an e-learning site with 100+ tutorials", 100)) Įcho substr("eduCBA is an e-learning site with 100+ tutorials", 0, 16) Įcho substr("eduCBA is an e-learning site with 100+ tutorials", 2, 5) Įcho substr("eduCBA is an e-learning site with 100+ tutorials", -10, 4) Įcho substr("eduCBA is an e-learning site with 100+ tutorials", 0, -10) Įcho substr("eduCBA is an e-learning site with 100+ tutorials", -9, -1) PHP substr() with negative starting position.Įcho substr("eduCBA is an e-learning site with 100+ tutorials", 17) Įcho substr("eduCBA is an e-learning site with 100+ tutorials", -7) Įcho substr("eduCBA is an e-learning site with 100+ tutorials", -30) Let us see some of the examples: Example #1 Take an input string and apply the substr() method to get the specified portion of the string. Substr() if successful returns extracted part of the string, then returns false or failure or an empty string.If this parameter is not passed, then substr() will return the string starting at the start_position_of_string till the end. ![]()
0 Comments
Read More
Leave a Reply. |