- substr: documentation ( source)
- strpos: documentation ( source)
- ucwords: documentation ( source)
- explode: documentation ( source)
<?php
$data = "destination=Apartment+TITLIS+Resort+Wohnung+721&hotelid=0123454656";
if (($pos = strpos($data, "=")) !== FALSE) {
$whatIWant = ucwords(substr($data, $pos+1));
$whatIWant = explode("&", $whatIWant);
$whatIWant = $whatIWant[0];
echo "Ans1: \n";
echo $whatIWant;
// Output: Apartment+TITLIS+Resort+Wohnung+721
// if you want your output with & just add &
echo "\n\nAns2: \n";
$whatIWant = $whatIWant."&";
echo $whatIWant;
// now Output iss:
// Apartment+TITLIS+Resort+Wohnung+721&
}
?>