Skip to content

Instantly share code, notes, and snippets.

@sungraizfaryad
Created November 4, 2019 15:28
Show Gist options
  • Select an option

  • Save sungraizfaryad/a2f2b1443ad109c3c729f2a93d1faf2b to your computer and use it in GitHub Desktop.

Select an option

Save sungraizfaryad/a2f2b1443ad109c3c729f2a93d1faf2b to your computer and use it in GitHub Desktop.
<?php
function inspiry_readable_price_format($price){
// first strip any formatting;
$price = (0+str_replace(",","",$price));
// now filter it;
if($price>1000000000000){
$price = round(($price/1000000000000),1). esc_html__(' T', 'easy-real-estate');
}
else if($price>1000000000) {
$price = round(($price/1000000000),1). esc_html__(' B', 'easy-real-estate');
}
else if($price>1000000){
$price = round(($price/1000000),1). esc_html__(' M', 'easy-real-estate');
}
else if($price>1000) {
$price = round(($price/1000),1). esc_html__(' K', 'easy-real-estate');
}
return $price;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment