Posts Tagged ‘Functions’

PHP useful functions

Following are some non common functions, Which generally do not use frequently or do not recollect when we need it.

  • iconv — Convert string to requested character encoding
    string iconv ( string $in_charset , string $out_charset , string $str )

    Example:
    $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);

    Output: Développeur Web -> Developpeur Web

  • var_export — Outputs or returns a parsable string representation of a variable
    mixed var_export ( mixed $expression [, bool $return= false ] )

    Example:
    $a = array (1, 2, array (“a”, “b”, “c”));
    var_export($a);

Note: List will keep updated as I will come across such functions.