Using notepad++ and Xdebug to debug PHP scripts under Windows

Source: Internet
Author: User


Introduced



notepad++ is an alternative Notepad editor for open source code. It runs in the MS Windows environment and supports a variety of programming languages. You can browse http://notepad-plus.sourceforge.net/for more information.



Xdebug is an extension of PHP that provides a variety of functions for debugging, tracking, and checking PHP scripts. You can browse http://xdebug.org for more information.



Download



notepad++ Download Address: Http://nchc.dl.sourceforge.net/sourceforge/notepad-plus/npp.4.7.5.Installer.exe



notepad++ plugin DBGP Plugin:http://nchc.dl.sourceforge.net/sourceforge/npp-plugins/dbgpplugin_0_7b_fix_dll.zip



Xdebug:http://xdebug.org/link.php?url=xdebug202-52-win



* Xdebug version needs to match the environment using the PHP version, where the links provided for PHP 5.2.1-5.2.7 use Xdebug.



Xdebug Helper for firefox:https://addons.mozilla.org/zh-cn/firefox/addon/3960



Installation



The installation of notepad++ is as simple as most Windows software. Simply follow the on-screen prompts and click "Next" and the final "finish" can be installed successfully.



In order for notepad++ and Xdebug to work together, DBGP plugin need to be installed. After downloading, simply unzip to the plugins directory in the notepad++ installation directory, such as: C:Program Filesnotepad++plugins.



Xdebug installation Please refer to: Http://www.mikespook.com/index.php/archives/34. What needs to be explained is that if the XCache is installed at the same time must first load XCache, then load Xdebug. Otherwise it will cause PHP to run abnormally.



Use



First, you will write two functions that use recursive methods and use loops to compute the factorial of 100, as follows:



<?php
Function f1($x)
// loop calculates the factorial of $x
{
For($i = $x - 1; $i > 1; $i–)
{
$x *= $i;
}
Return $x;
}
Function f2($x)
// Recursively calculate the factorial of $x
{
If($x == 1)
{
Return $x;
}
Else
{
$y = $x - 1;
Return $x * f2($y);
}
}
Echo ‘f1: ‘ . f1(10);
Echo ‘<br />’;
Echo ‘f2: ‘ . f2(10);



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.