PHP

Php code to find leap year or not

We can find a year is leap year or not in various ways.we can use the following fuctions in php.

  • By using date() function
  • By Modulus operator

Here is a sample php code that uses modulus(%)operator for finding the leap year.

Write the below code within php tags

[php]
<code>
<!–?PHP </p–> </code>

<code>$start = 1000;
$end = 1011;
for($i = $start; $i < $end; $i++)
{
if(($i%4) == 0){$val = "Leap Year";}else{$val = "Not Leap Year";}
echo $i, ‘ —> ‘.$val.”;
}</code>

?>
[/php]

It will produce the output as given below.

1000 —> Leap Year
1001 —> Not Leap Year
1002 —> Not Leap Year
1003 —> Not Leap Year
1004 —> Leap Year
1005 —> Not Leap Year
1006 —> Not Leap Year
1007 —> Not Leap Year
1008 —> Leap Year
1009 —> Not Leap Year
1010 —> Not Leap Year

You find leap years for any year ranges by changing the $start and $end.

Tags: ,

Php Tools

PHP is the commonly used open-source server-side scripting languages among all exist languages today. PHP has in depth credentials, a vast community, plenty of ready-to-use scripts and well-supported frameworks. It’s very easy to begin with PHP than with other scripting languages like Python, etc… That’s why PHP has huge community. PHP makes the development process easier and more effective with its tools and resources.

A lot of debugging and testing tools were available. Some of them were listed below.

Debugging Tools
MacGDBpPHP_DebugDBGGubed PHP DebuggerXdebugWebgrind






Testing Tools
PHPUnitdBugPHP_CodeSniffer   

   
 
 
 
 

Tags: ,

CGI Time Out The specified CGI application exceeded the allowed time for processing. The server has deleted the process.

Whenever we tried to run some large script like data extraction or trying to get thousand number of records from remote database, most of us will face the following CGI Issue

“The specified CGI application exceeded the allowed time for processing. The server has deleted the…”

In order to run your script without any such kind of issue, please follow the steps provided below. Earlier I too faced such a issue but after research in my PC I finally fixed it.

Note: the following steps is only suitable only for the Windows XP and with the IIS version 5.1:

Go to your Internet Information Services (IIS) page (Go Start -> Settings -> Control Panel -> Administrative tools -> Internet Information services)

Unfold Websites->Default Web site

Now right click on your website name (on which you are executing your script)

Select Properties

Select the tab Virtual Directory

In that page, select the option High (Isolated) under Application Protection, this option will remove the default timeout settings.

Now click on the button Configuration

Then select Process Options tab

Change the CGI Script Timeout value max value is 999999.

That’s it. You may now run your script without any issue.

Tags: ,

Request a Free SEO Quote