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ʃ0 (&bo6̶4 :O YDʃR_&'sy_}CD@ٛ)jX/z#658 ۔={̶g&n2A0Ɂ*YNH_n @1HubK9ΝRc~STsׁ-j#啣5h]P(iݤIr#0![\ߒ#32/ dQ ;m6=0ҿ;p <੣&AX&"@vҁEX|#_֛]l?L!u?ܣ P8p r37PWJ7͓Uӳm!U:q/6$xքJ'#uw2?L4Lp)MآQzU xv/oLOf\%}^D$34]_~zFXF_BVC<`A'[ V {>qHk~?LZ$pYW9W:17S+(e/~8 927zBƅ'!# ㉪*W:t1%fbq/i ~H!u?ܣ P8p ^GcE~*4&?F\&Zr1m'd%Ԫ$~sy`~E>}g 1n}ɂ"}b6` 'o%*UNM:7aC79Ï3n|ױ ]dT‡Xd倖V}릦sކH]qar_dump() function with its own version that includes (among other things) color coding for different PHP types, so you can see it in action immediately by using the var_dump() function in a PHP script. For example, create a simple PHP script in the htdocs\ subdirectory of your XAMPP installation directory with the following content:

<?php
var_dump($_SERVER);

When you view your script through a browser, here’s an example of what you might see:

image2

One of Xdebug’s most powerful features is its ability to profile a PHP script and produce detailed statistics on how long each function call or line of code takes to execute. This can be very useful for performance analysis of complex scripts. To turn on script profiling, follow these steps:

  1. Edit the php.ini file in the php\ subdirectory of your XAMPP installation directory. Within this file, find the [XDebug] section and within it, uncomment and modify the lines below so that they look like this:

    xdebug.profiler_append = 0
    xdebug.profiler_enable = 1
    xdebug.profiler_enable_trigger = 0
    xdebug.profiler_output_dir = "C:/xampp/tmp"
    xdebug.profiler_output_name = "cachegrind.out.%t-%s"
  2. Restart the Apache server using the XAMPP control panel.

At this point, Xdebug profiling is active. Every PHP script that you run will be profiled and the results will be placed in the C:\xampp\tmp as a so-called cachegrind file. You can view this cachegrind file with a tool like WinCacheGrind, which you must download and install separately.

To illustrate how this works, consider the screenshot below, which shows the profiled output of a script using WinCacheGrind. As the screenshot illustrates, it’s easy to see the entire life cycle of a PHP script, including the call sequence and the amount of time taken by each function, and thereby find targets for further optimization.

image3
To find out more about Xdebug’s powerful features, read the Xdebug documentation.