Xdebug document (ii) variable display characteristics

Source: Internet
Author: User

Xdebug can replace PHP's Var_dump () function to display variable values. The version of Xdebug contains count group element/object properties, maximum depth, and string lengths for different data types identified by different colors. There are also some features that work well with variable displays.

Related settings:

Xdebug.cli_color

Type: integer, default: 0, starting at 2.2 version

When set to 1 o'clock, Xdebug will track output text in a colored display var_dump in CLI mode and when the TTY terminal outputs. window, the Ansicon tool needs to be installed.

When set to 2 o'clock, Xdebug will always display var_dump and debug trace information in color, regardless of whether the connection to the TTY terminal or Ansicon is installed. In this case, you may see the escape code at the end.

Xdebug.overload_var_dump

Type: Boolean, default: 2 (before 2.4, the default value is 1), starting at 2.1 version

Xdebug by default, the Var_dump () function uses its own improved version to display variables if Html_errors is set to 1 or 2 o'clock in php.ini. If you really don't want to set this up, you can set this setting to 0, but make sure it doesn't turn off the html_errors intelligently.

We recommend that you use a value of 2. In addition to its beautifully formatted display of the Var_dump () output, it also outputs the display file name and line number. In addition Xdebug.file_link_format also provided (2.3 version of the new features).

Xdebug.var_display_max_children

Type: Integer, default value: 128

This setting controls the display of the number of array elements and object properties when using Xdebug_var_dump (), xdebug.show_local_vars, or trace functions.

It can be set to a value of 1 if not restricted.

This setting is not affected by Remot_debuggin remote debugging.

Xdebug.var_display_max_data

Type: Integer, default value: 512

This setting controls the length of the string to display the maximum value when using the Xdebug_var_dump (), xdebug.show_local_vars, or trace function.

It can be set to a value of 1 if not restricted.

This setting is not affected by remot_debugging remote debugging.

Xdebug.var_display_max_depth

Type: integer, default value: 3

This setting controls the display level of array elements and object properties when using Xdebug_var_dump (), xdebug.show_local_vars, or trace functions.

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

This setting is not affected by remot_debugging remote debugging.

Related functions:

void Var_dump ( [Mixed Var [, ...]] )

Displays the details of the variable.

This function has been overwritten by Xdebug, see Xdebug_var_dump ().

void xdebug_debug_zval ( [string varname [, ...]] )

This function is used to display structured information for one or more variables, including their type, value, and referenced information. The array iterates through the element values recursively. This function is different from the implementation of PHP's Debug_zval_dump () function, which solves the problem that the variable itself needs to be passed to the function. The xdebug version of the function better leverages the variable name to find the variable in the internal symbol table and directly accesses all the attributes without having to deal with the problem of passing the variable to the function. The information returned by the function can express zval information more accurately.

Example:

<? PHP     $a Array (1, 2, 3);     $b $a ;     $c $a [2];    Xdebug_debug_zval (' a ');    Xdebug_debug_zval ("a[2]");? >/**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 [, ...]] )

Same as Xdebug_debug_zval (), but the function does not display this information through the Web API interface, but it is displayed directly on the STDOUT device (for example, it can be run in Apache single-process mode and displayed in the terminal).

void xdebug_dump_superglobals ()

This function displays the value of the element for the Super global variable, and the value to display is set in the xdebug.dump.* of PHP.ini. For example, the php.ini is set as follows:

Example:

xdebug.dump.get=*Xdebug. Dump. Server=Remote_addrquerystring:?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 ' (length=10)$_get[' array '] =Array' A ' + =string' A ' (length=1)  9 =string' B ' (length=1) 

void xdebug_var_dump ( [Mixedvar [, ...] )

The function displays the structured details of one or more expressions containing the type and value. The array recursively explores its element values.

Example:

<?PHPIni_set(' Xdebug.var_display_max_children ', 3 );$c=NewStdClass;$c->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 Elemen  Ts...  ' object ' = = Object (StdClass) [1] public ' foo ' = + string ' bar ' (length=3) public ' file ' = resource (3, Stream)*/

Xdebug document (ii) variable display characteristics

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.