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.

2
  • What do you mean by split up function ? Commented Mar 7, 2018 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 Commented Mar 7, 2018 at 6:40

2 Answers 2

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 and acknowledge you have read our privacy policy.

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