.josh Posted October 12, 2009 Share Posted October 12, 2009 In you opinion, what do you think is the most "badass" built-in php function? Like..."Holy shit I didn't know there was something out there for xyz, I somehow feel like I just learned a new kung-fu move! <swipe hands in air pretending you really know kung-fu>" Quote Link to comment https://forums.phpfreaks.com/topic/177485-most-badass-built-in-php-function/ Share on other sites More sharing options...
corbin Posted October 12, 2009 Share Posted October 12, 2009 I think the PCRE functions are all quite ninja. But really nothing ever surprises me. I think it's because I started on PHP, so I expect all the super simplifying functions to be there lol. Quote Link to comment https://forums.phpfreaks.com/topic/177485-most-badass-built-in-php-function/#findComment-935811 Share on other sites More sharing options...
nrg_alpha Posted October 13, 2009 Share Posted October 13, 2009 Hmm.. that's a tough one.. I agree with corbin mentioning PCRE... but once you learn it, it's old hat (much like anything else I suppose). For me, as of late, it's not so much about something built-in that blows my socks off or anything, but nice to know ones: The Reflection API offers built-in classes that provide a nice way to 'reverse engineer' objects to see what they are comprised of (something I have only started making use of as of late - I know, I'm late to the reflection party so to speak). I'm digging PHP 5.3's closures (a closure is a 'kind of anonymous' function that can be stored as a variable and is contextual with regards to variables involved). Simple example: $x = 2; $addStuff = function() use ($x){ $args = func_get_args(); // get unknown list of function() parameters (if no params are present, $arg will be set yet empty) if(count($args)){ foreach($args as &$val){ $val += $x; } return $args; } else { echo 'No values passed into function()'; } }; $arr = $addStuff(3,7); // you can add or remove parameters here and function() will be flexible echo '<pre>'.print_r($arr, true); EDIT - the flexible part of parameters is not due to function() itself, as this can be done with a regular function.. Quote Link to comment https://forums.phpfreaks.com/topic/177485-most-badass-built-in-php-function/#findComment-935843 Share on other sites More sharing options...
Garethp Posted October 13, 2009 Share Posted October 13, 2009 Well, I started on PHP aswell, but I never expected FTP! I learned it and I was all like WOW! ... Then I realised it wasn't all that cool. But when I found out about DOM OH YEAH! Quote Link to comment https://forums.phpfreaks.com/topic/177485-most-badass-built-in-php-function/#findComment-935949 Share on other sites More sharing options...
448191 Posted October 13, 2009 Share Posted October 13, 2009 I'd have to say do_what_i_want_now_please(). (no offense to anyone's third cousin removed ) Quote Link to comment https://forums.phpfreaks.com/topic/177485-most-badass-built-in-php-function/#findComment-935961 Share on other sites More sharing options...
zq29 Posted October 13, 2009 Share Posted October 13, 2009 I think levenshtein(), soundex() and metaphone() are pretty bad-ass. I've not yet had a requirement for soundex() or metaphone() though. Quote Link to comment https://forums.phpfreaks.com/topic/177485-most-badass-built-in-php-function/#findComment-935980 Share on other sites More sharing options...
Mchl Posted October 13, 2009 Share Posted October 13, 2009 Just starting toying with them, but SPL file objects and iterators seem to be cool. Quote Link to comment https://forums.phpfreaks.com/topic/177485-most-badass-built-in-php-function/#findComment-935987 Share on other sites More sharing options...
xylex Posted October 13, 2009 Share Posted October 13, 2009 date_sunrise() and date_sunset() Quote Link to comment https://forums.phpfreaks.com/topic/177485-most-badass-built-in-php-function/#findComment-936122 Share on other sites More sharing options...
corbin Posted October 13, 2009 Share Posted October 13, 2009 date_sunrise() and date_sunset() Wow... Those are pretty nifty. Quote Link to comment https://forums.phpfreaks.com/topic/177485-most-badass-built-in-php-function/#findComment-936354 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.