Question

My script for showing the discount amount or percentage is;

function DisplayDiscount($value)
    {
        if (strstr($value,'%'))
             $discount = "%".substr($value, 0, -1); //$discount = $value;
        else
            $discount = $value.SITE_CURRENCY;

        return $discount;
    }

Outcomes;

  • %18.30
  • 18.30 XX

I want to eliminate the space between the value and XX but I could not figure it out.

Was it helpful?

Solution

Try to like This:

    $input = " aa bb ";
    $output = str_replace(" ","",$input);
    echo $output;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top