Skip to content

Instantly share code, notes, and snippets.

View davidstanley01's full-sized avatar

David Stanley davidstanley01

View GitHub Profile

Keybase proof

I hereby claim:

  • I am davidstanley01 on github.
  • I am davidstanley01 (https://keybase.io/davidstanley01) on keybase.
  • I have a public key ASDgJerxBZNNodWKDiHtx4MPQsGCaa1OBD0Vx8dOB1Mg-wo

To claim this, I am signing this object:

@davidstanley01
davidstanley01 / example.php
Last active May 20, 2016 21:32
compare collections and get values from one that aren't in the other
<?php
// Given 2 collections of nested, indexed arrays,
// find the items in the first array that are not
// found in the second array using a given key
// in this example, find items in $collection1 that
// are not found in $collection2, and return all of
// them as a new collection
$collection1 = collect([
['product' => 'Desk', 'price' => 200],
<?php
function getFizzBuzz($max) {
for ($i = 0; $i < $max; $i++) {
$string = null;
$string = ($i % 15) === 0 && is_null($string) ? 'FizzBuzz' : null;
$string = ($i % 3) === 0 && is_null($string) ? 'Fizz' : $string;
$string = ($i % 5) === 0 && is_null($string) ? 'Buzz' : $string;
yield $string;