Hi Folks !!
i have a string like this. "../images/gallery/New-Goa-Park-in/86ffbca77051448489aec640d288153a.jpg"
from this path i want only ../images/gallery/New-Goa-Park-in/
how can i do it?
Please help
Thanks.
Hi Folks !!
i have a string like this. "../images/gallery/New-Goa-Park-in/86ffbca77051448489aec640d288153a.jpg"
from this path i want only ../images/gallery/New-Goa-Park-in/
how can i do it?
Please help
Thanks.
Hi Folks !!
i have a string like this."../images/gallery/New-Goa-Park-in/86ffbca77051448489aec640d288153a.jpg"
from this path i want only../images/gallery/New-Goa-Park-in/
how can i do it?Please help
Thanks.
<?
$str = "../images/gallery/New-Goa-Park-in/86ffbca77051448489aec640d288153a.jpg";
$str_exploded = explode("/", $str);
for($i = 0; $i <= 3; $i++)
{
$new_str .= $str_exploded[$i]."/";
}
echo $new_str;
?>
1:get the index of '/' from that's String
2:stor the above index
3 search for another '/'
id there ,, jump to step 1
other wise copy subString from index 0 to latest index of '/'
just get the latest '/' within assumed string
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.