Is there any way in PHP to create a substring from given start index to given last index?
Supposed that I have this string
$str = "abcdef";
And I want to extract "cd" from $str.
I realize that I can use substr ($str, 2, 2), but my $str will depend on user input so the parameter won't be the same.
P.S. I'll combine the substr with strpos and strripos function.
Supposed that I have this string
$str = "abcdef";
And I want to extract "cd" from $str.
I realize that I can use substr ($str, 2, 2), but my $str will depend on user input so the parameter won't be the same.
P.S. I'll combine the substr with strpos and strripos function.