Salagir's Blog

Old name was: "Why do witches burn?"

Ceci est la version anglaise. Aller à la version Française

PHP functions reminder

Le avril 10th, 2013

I love PHP, but when it comes to consistency, it sucks very very very hard.

I’m tired of going to the (very very good) site to check functions arguments and order and such, so now, all what I usually check will be here.
Nothing here is « complete ». My goal isn’t to make a doc, but a reminder of what I use.

Order of arguments in string/array functions

strpos ( $content , $search );
str_replace ( $search, $replace, $content );
array_search ( $search, $array);
in_array ( $search, $array);


Beloved classic flags

Flags I use all the time and won’t learn by heart.

preg_split ( $pattern, $content , -1, PREG_SPLIT_NO_EMPTY);


The table of ob_start() (output buffering) related functions !

Empty buffer Flush(=write) buffer Returns buffer Stop buffering
ob_clean() YES
ob_end_clean() YES YES
ob_end_flush() YES YES YES
ob_flush() YES YES
ob_get_clean() YES YES YES
ob_get_contents() YES
ob_get_flush() YES YES YES YES

ob_get_contents() should be named ob_get(). But you know… php and naming conventions…. T_T

Leave a Reply