I think mine would be json_encode(). I think it's so cool that a single function can make your data understood by other machines. (I know other machines can interpret different kinds of data, but c'mon...)
How about you? What's your favourite function?
Latest comments (36)
curryfunction is probably my prefered one.For those who don't know its utility, here's a basic example:
I even made my own optimized version 😄
npmjs.com/package/super-curry.
I don't really have a favorite function, because it's all about using the right one to solve a problem. ut I like functions that make things simpler, so I think I'd pick fetch(). Because before, making HTTP requests from JavaScript looked like this
reduceis my favorite.When something went unexpectedly wrong..
I don't know why but I just love
sprintf()in php ... It's very useful and much more elegant than just endlessly concatenate strings !And less elegant but really useful once again,
die(var_dump())has a special place in my heart ...list.zip (other).map ((a,b) =>...)
In Ruby, backticks are a function call. And what's especially cool is that heredocuments with backticks call the same function, but with multi line arguments. So you can define them to do other, more interesting things, like call out to other languages! In practice, I mostly use it when experimenting with some slightly tedious external resource, I basically learned PostgreSQL by running them through these kinds of functions.
In PHP I always include file with my custom helper functions. These two wrap output with
<pre/>tags, which allows nice&quick debugging via browser from any class or template code.HA! I have a pre() function too! I use it many, many times a day. Mine has the $obj, but then a title, so if I have multiple pre()s going, I know which is which. Like, pre( $obj, 'This is the user obj');
Love it.
var_masterpiece is also an excellent browser extension too for debugging!
Love throwing exceptions around ;)
map, filter, reduce, forEach, Array.prototype.some, Array.prototype.every
Working with array in Javascript never been easier.
Love it all!
Agreed, high order functions are best