1
$productRatio = $_productCollection->getRatio();

I got 3:1 , How to assign this to two different variables. 3 should be assigned to $resin and 1 should be assigned to $hardner. I tried this but am getting error.

$resin:$hardner :: $productRatio ;

1 Answer 1

1

You can just set your value using below way,

$newValue = explode(":",$productRatio);
$resin = $newValue[0];
$hardner = $newValue[1];
echo $resin.':'.$hardner;
2
  • Thank you so much Rakesh. Its Working fine.I was trying since yesterday.thanks once again. Commented Jul 4, 2017 at 5:43
  • @Dilip Glad to know you have helpful Commented Nov 29, 2017 at 13:00

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.