Xdebug document (2) variable display features, xdebug document _ PHP Tutorial

Source: Internet
Author: User
Xdebug document (2) variable display features, xdebug document. Xdebug (II) variable display feature. xdebug can replace the var_dump () function of PHP to display variable values. The xdebug version includes array element object attributes for different data types. Xdebug document (2) variable display features. xdebug document

Xdebug can replace the var_dump () function of PHP to display variable values. The xdebug version contains array element/object attributes, maximum depth, and string length for different data types, which are identified in different colors. Some functions can be used to display variables.

Related settings:

Xdebug. cli_color

Type: integer. default value: 0. it starts with version 2.2 or later.

When it is set to 1, xdebug displays the output text of the var_dump trace in CLI mode and when it is output on the tty terminal. The ANSICON tool must be installed in Windows.

When set to 2, xdebug displays var_dump and debug trace information in color regardless of whether it is connected to the tty terminal or whether ANSICON is installed. In this case, you may see the escape code at the end.

Xdebug. overload_var_dump

Type: boolean, default value: 2 (before version 2.4, the default value is 1), starting with version 2.1 or later

By default, xdebug overload the var_dump () function to display variables using its own release version. if html_errors is set to 1 or 2 in php. ini. If you really don't want this setting, you can set it to 0, but make sure it does not intelligently close html_errors.

We recommend that you use 2. In addition to var_dump () output, it also displays the file name and row number. In addition, xdebug. file_link_format is also provided (new feature of version 2.3 ).

Xdebug. var_display_max_children

Type: integer; default value: 128

When xdebug_var_dump (), xdebug. show_local_vars, or tracing function is used, this setting controls the display of the number of array elements and object attributes.

If not limited, it can be set to-1.

This setting is not affected by Remot_Debuggin remote debugging.

Xdebug. var_display_max_data

Type: integer; default value: 512

When xdebug_var_dump (), xdebug. show_local_vars, or tracing function is used, this setting controls the maximum value of string length display.

If not limited, it can be set to-1.

This setting is not affected by Remot_Debugging remote debugging.

Xdebug. var_display_max_depth

Type:Integer, Default value:3

When xdebug_var_dump (), xdebug. show_local_vars, or tracing function is used, this setting controls the display level of array elements and object attributes.

The maximum value is 1023. you can set it to-1 to indicate its maximum value.

This setting is not affected by Remot_Debugging remote debugging.

Related functions:

VoidVar_dump ([Mixed var [,...])

Displays detailed information about a variable.

This function has been overwritten by xdebug. for details, see xdebug_var_dump ().

Void Xdebug_debug_zval ([String varname [,...] )

This function is used to display the structured information of one or more variables, including their types, values, and referenced information. The array is the recursive exploration element value. This function is different from the debug_zval_dump () function in PHP. it can solve the problem that variables must be passed to this function. The Xdebug function makes better use of the variable name to search for the variable in the internal symbol table and directly accesses all attributes without the need to handle the problem that the variable is passed to the function. The information returned by this function can more accurately express zval information.

Example:

 /**Returns:a: (refcount=2, is_ref=1)=array (    0 => (refcount=1, is_ref=0)=1,    1 => (refcount=1, is_ref=0)=2,    2 => (refcount=2, is_ref=1)=3)a[2]: (refcount=2, is_ref=1)=3*/

Void Xdebug_debug_zval_stdout ([String varname [,...] )

It is the same as xdebug_debug_zval (), but this function does not display this information through the web API interface, but it is directly displayed on the stdout device (for example, it can run in apache single-process mode and be displayed on the terminal ).

Void Xdebug_dump_superglobals ()

This function displays the element value of the Super global variable. The value to be displayed is set in xdebug. dump. * of php. ini. For example, set php. ini as follows:

Example:

xdebug.dump.GET=*xdebug.dump.SERVER=REMOTE_ADDRQuery string:?var=fourty%20two&array[a]=a&array[9]=bReturns:Dump $_SERVER$_SERVER['REMOTE_ADDR'] =string '127.0.0.1' (length=9)Dump $_GET$_GET['var'] =string 'fourty two' (length=10)$_GET['array'] =array  'a' => string 'a' (length=1)  9 => string 'b' (length=1) 

VoidXdebug_var_dump ([Mixedvar [,...])

This function displays structured details of one or more expressions, including types and values. The array recursively explores its element values.

Example:

 foo = 'bar';$c->file = fopen( '/etc/passwd', 'r' );var_dump(    array(        array(TRUE, 2, 3.14, 'foo'),        'object' => $c    ));?>  /**Returns:array  0 =>    array      0 => boolean true      1 => int 2      2 => float 3.14      more elements...  'object' =>    object(stdClass)[1]      public 'foo' => string 'bar' (length=3)      public 'file' => resource(3, stream)*/

(2) display of variables. xdebug can replace the var_dump () function of PHP to display variable values. The xdebug version contains array elements/object attributes for different data types...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.