0

I want to split the following code.

<?php echo $currencySymbol." ".str_replace(",","",$custom_area1['mrp']); ?>

Currently it shows at $ 100 for example

The $ I understand is coming from <?php echo $currencySymbol." ". While the amount is coming from str_replace(",","",$custom_area1['mrp'])

How do I split it up so there is a function for $ and a function for the amount.

  • What do you mean by split up function ? – Kishan Patadia Mar 7 '18 at 6:33
  • so right now by using this <?php echo $currencySymbol." ".str_replace(",","",$custom_area1['mrp']); ?> It shows $ 100 I want two functions from the above function to show the $ and 100 separately – user2240778 Mar 7 '18 at 6:40
0
public function getCurrencySymbol(){
  return $currencySymbol;
}
public function getAmount(){
  $amount = str_replace(",","",$custom_area1['mrp']);
  return $amount;
}
0

This worked for me

<?php echo $currencySymbol;?>

<?php echo str_replace(",","",$custom_area1['mrp']); ?>/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.