Filtering reality

adrian smith
1 min readSep 17, 2016

--

hey maybe you read this? https://medium.com/@sfyire/everything-in-its-right-place-dae94cbe15b7#.hbzscngzx

and maybe you thought hey that’s great but what if I need my article ID to be 166, and my $body is ‘sexy’, if not then I want my PHP app to phone the cops.

So first step is you’re going to need to install composer to download Twilio, no wait, fuck you make your own app, I’m here to talk about filtering reality

So let’s say we have our happy little article:

Yep, okay but maybe, everything is on fire and the article isn’t sexy enough to get posted to our most clickbaity website, we are going to have to distort and filter this out, do this:

Then from that point in your application only deal with valid articles, because we are now dealing with an array we can map + reduce + filter over it some more, without full life consequences because an empty array will just do nothing with those operations.

If there’s a point where we definitely need to collapse the wave function then a simple if (count($valid_articles)) would be nice for semantics, or if ($valid_articles), thanks weak typing!

Do you like rabbit holes to no where? read on! https://medium.com/@sfyire/all-change-here-a0d2f1b53876#.4nkasp9o6

--

--