substr()
functionThe PHP substr()
function can be used to get the substring i.e. the part of a string from a string. This function takes the start and length parameters to return the portion of string.
Let's check out an example to understand how this function basically works:
<?php
$str = "Hello World!";
echo substr($str, 0, 5); // Outputs: Hello
echo substr($str, 0, -7); // Outputs: Hello
echo substr($str, 0); // Outputs: Hello World!
echo substr($str, -6, 5); // Outputs: World
echo substr($str, -6); // Outputs: World!
echo substr($str, -12); // Outputs: Hello World!
?>
i hope you like this small article.
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
How to Send email in Django using Google SMTP server
Sending emails is one of the important p...Laravel 8 - Image Resize Before Upload
I am able to explain one by one article...How to unzip a file in PHP
If you are working in a project which co...Django - How to Create Custom Login Page
Within this article we will look at how...Laravel 8 queue and job example tutorial
In the previous article, we have discuss...