Guest User

Untitled

a guest
May 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <?php
  2.  
  3. class PH {
  4.  
  5. public static function array_remove(&$array, $keys) {
  6. foreach($keys as $key){
  7. if( array_key_exists($key,$array) ) unset($array[$key]);
  8. }
  9. return $array;
  10. }
  11.  
  12. public static function cena($cena){
  13. return number_format($cena,0,',','.');
  14. }
  15.  
  16. public static function przedzial($cena,$koncowka = 'zł'){
  17. $tmp = explode('-',$cena);
  18. if( (int)$tmp[0] == 0 ){
  19. $przedzial = 'do '.self::cena($tmp[1]).' '.$koncowka;
  20. }elseif( $tmp[1] == 0 ){
  21. $przedzial = 'powyżej '.self::cena($tmp[0]).' '.$koncowka;
  22. }else{
  23. $przedzial = 'od '.self::cena($tmp[0]).' '.$koncowka.' do '.self::cena($tmp[1]).' '.$koncowka;
  24. }
  25. return $przedzial;
  26. }
  27. }
Add Comment
Please, Sign In to add comment