Miscellaneous Functions


This chapter discusses a variety of functions that don't really fit neatly into existing categories, but that we felt were too important and useful to leave out of this book. Accordingly, we'll simply categorize them as "miscellaneous."

OverviewThis section contains functions for the following tasks:

  • Working with constants

    constant() - Returning the value of a constant

    define() - Defining a named constant

    defined() - Checking whether a given named constant exists

  • Ending script execution

    die() - Outputting a message and terminating the current script

    exit() - Terminating the current script

  • Evaluating strings as PHP code

    eval() - Evaluating a string as PHP code

  • Retrieving information about the capabilities of a browser

    get_browser() - Telling what the user's browser is capable of

  • Performing syntax highlighting for PHP

    highlight_file() - Syntax highlighting of a file

    highlight_string() - Syntax highlighting of a string

    show_source() - Syntax highlighting of a file

  • Parsing IPTC blocks

    iptcparse() - Parses a binary IPTC http://www.iptc.org/ block into single tags

  • Leaking memory

    leak() - Leaks memory

  • Delaying the execution of a script

    sleep() - Delays execution

    usleep() - Delays execution in microseconds



Configuring the Miscellaneous FunctionsNo configuration directives currently affect how the miscellaneous functions work.

Installing Miscellaneous Function SupportThe Miscellaneous functions are built into PHP by default. If desired, individual functions can be disabled in the php.ini file via the disable_functions directive.