Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $nums = Collection::make([5, 7, 1, 5, 9, 11, 3, 2, 1, 1, 7, 5]);
- $nums->avg(); //átlag: 4.75
- $nums->sum(); //összeg: 57
- $nums->max(); //max érték: 11
- $nums->count(); //mennyiség: 12
- $nums->countBy(); //miből mennyi van? (Collection az eredmény, [5 => 3, 7 => 2, ...])
- $nums->random(); //random szám
- $nums->random(3); //3 db random szám
- $nums->shuffle(); //megkeveri random
- $stat = Collection::make([
- ['apple' => 100, 'pear' => 56, 'cherry' => 12],
- ['apple' => 45, 'pear' => 157, 'cherry' => 22],
- ['apple' => 3, 'pear' => 75, 'cherry' => 33],
- ['apple' => 19, 'pear' => 13, 'cherry' => 33]
- ]);
- $stat->sum('apple'); //almák összesen: 167
- $stat->median('pear'); //körték mediánja: 65.5
- $stat->mode('cherry'); //cseresznyék módusza: [33]
Add Comment
Please, Sign In to add comment