Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. [5] => Object1
  2. (
  3. [id] => 1
  4. [name] => abb
  5. [costs] => 33
  6. )
  7.  
  8. [6] => Object2
  9. (
  10. [id] => 2
  11. [name] => bcc
  12. [costs] => 55
  13. )
  14.  
  15. [4] => Object3
  16. (
  17. [id] => 2
  18. [name] => fff
  19. [costs] => 66
  20. )
  21.  
  22. [3] => Object4
  23. (
  24. [id] => 4
  25. [name] => fff
  26. [costs] => 55
  27.  
  28. function mySort($a,$b) {
  29.  
  30. if($a->costs > $b->costs) return -1; - работает
  31. if($a->costs < $b->costs) return 1; - работает
  32. if ($a->costs == $b->costs) { - не сравнивает
  33. }
  34.  
  35. 'id' => 'service5',
  36. 'name' => 'YouTube',
  37. 'costs' => 8064,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement