Your Ad Here

 Navigation
Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Books
Sample Chapters
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links




 Sponsors
 Links
gambling sites
golfing products
dropshippers
 Downloads
dzphp editor
EasyPHP
mysql_phpgenerator
php-studio-trial
phpdesigner_7_2_5
phpMyAdmin-3.4.3.2
/phptriad2-2-1
phpxedit_321
rapidphp 2011
WampServer2.1d-x64
WampServer2.1e-x32
xampp-win32-1.7.4-VC6-installer
xampplite-win32-1.7.3
 Misc
Webmaster Resources
Only PHP
ScriptSearch.com
Scripts.com - Get the best scripts NOW!
AndreaPHP Programming

Valid XHTML 1.0 Transitional


Valid CSS!


Some PHP functions you must know


PHP is a widely-used general-purpose scripting language that is
especially suited for Web development and can be embedded into HTML.
PHP has more than several thousands functions for many purpose.

For writing a program in any language we need basic language construct,
syntax and a large number of functions to get the desired result from
program.

In this article I will write about the some functions of PHP which are
very useful in creating a bug free, clean and efficient program.

We used print and echo functions to send the output to browser. so they
are of course one of the necessary functions of PHP. Without using them
you can not write a PHP program or at least can not show your work to
the world.

You must know the functions describe in this article, in order to write
a good and bug free code.

These are :-


error_reporting

The error_reporting() function sets the error_reporting directive at
runtime. PHP has many levels of errors, using this function sets that
level for the duration (runtime) of your script.


isset

This function determine whether a variable is set or not. It is very
useful in avoiding Notices generated by setting your error_reporting to
E_ALL. Undefined or un-initialised variables may be the main reasons
for many irritating bugs in your program, but remember isset() only
works with variables as passing anything else will result in a parse
error. For checking if constants are set use the defined() function.

print_r

This function prints human-readable information about a variable
It displays information about a variable in a way that's readable by
humans. If given a string, integer or float, the value itself will be
printed. If given an array, values will be presented in a format that
shows keys and elements. Similar notation is used for objects.

var_dump

This function displays structured information about one or more
expressions that includes its type and value. Arrays and objects are
explored recursively with values indented to show structure. In some
ways print_r and var_dump are similar.

ini_set and ini_get

These functions sets and gets the value of the given configuration
option. Returns the old value on success, FALSE on failure. The
configuration option will keep this new value during the script's
execution, and will be restored at the script's ending.
Not all the available options can be changed using ini_set(), You can
consult the PHP manual for a full list of available variables.

set_time_limit

This function set the number of seconds a script is allowed to run. If
this is reached, the script returns a fatal error. The default limit is
30 seconds or, if it exists, the max_execution_time value defined in the
php.ini. If seconds is set to zero, no time limit is imposed. It is very
usefull if you are working with a script which may take some time to
finish like sending a large number of emails.

When called, set_time_limit() restarts the timeout counter from zero. In
other words, if the timeout is the default 30 seconds, and 25 seconds
into script execution a call such as set_time_limit(20) is made, the
script will run for a total of 45 seconds before timing out.

set_time_limit() has no effect when PHP is running in safe mode. There
is no workaround other than turning off safe mode or changing the time
limit in the php.ini.

As I have told you , using these functions you can write a good and
bug free code so keep using them

About the Author

Zareef Ahmed is php developer based in india, Delhi. He is doing web development since last five-six years.
He can be contacted at zareef@zareef.net. To know more about him you can visit his home page at http://www.zareef.net


Written by: Zareef Ahmed

 



Here is our complete list of articles


Apache MySQL and PHP for Windows

Apache MySQL PHP for Windows

ASP CGI and PHP Scripts and Record Locking What Every Webmaster Needs To Know

Autoresponders With PHP

Bring Your Web Site to Life With PHP

Clickbank Security Using PHP

Create a Simple Effective PHP Form for Your Web Site

Creating Dynamic Website Content with PHP MySQL

Developing a Login System with PHP and MySQL

Developing State enabled Applications With PHP

For Automated Sites PHP and MySQL are A Perfect Match

Get PHP pages indexed in the Search engines

Getting your Visitors Details Using PHP

How PHP Can Help Save You Time And Mistakes

How to make a simple form mailer with PHP

HTACCESS Wrappers with PHP

Maguma has integrated support for the eBay Acellerator Toolkit for PHP PHP AT in their PHP IDE Maguma Workbench

Make a Search Engine For Your Website With PHP

Mastering Regular Expressions in PHP

More Autoresponders With PHP

MySQL Database Handling in PHP

ONLINE the eBay Accelerator Toolkit for PHP PHP AT for the PHP IDE Maguma Workbench is available

Password Protection and File Inclusion With PHP

Password Protection with PHP MySQL and Session Variables

PHP Account Activation

PHP and Cookies a Good Mix

PHP Auto surf Websites

PHP Databases

PHP Dynamic Content

PHP Email

PHP Encryption

PHP Error Pages

PHP Files

PHP Form Series Part 1 Validators Client side Validation

PHP General Scripting

PHP Image Gallery

PHP in the Command Line

PHP is 10 years old

PHP my favorite Server side Programming Technology

PHP On The Fly

PHP Pear Packages Why they are so important to php developers

PHP Redirect

PHP Scripts Dont Have to End in PHP

PHP Server to Client with No Refresh

PHP Sessions / Cookies

PHP Templates

PHP User Login Authentication

PIM Team Case Study Creating Text Effects With PHP and GD

Protecting your HTML and PHP Source Code

Quick Intro to PHP Development

Serialize this Saving Objects in PHP

Simple Solution for Php Includes IFrames

Site Personalization With PHP

Track Your Visitors Using PHP

Victoryvisions The PHP/Mysql Company Complete website development company



Books
 Sponsors


 Random Code
foreach example(beginner)
List all files in a directory and place them in a select menu(file system)
using the array_shift function(beginner)
 Random Article
  Network
Programming resources
Tutorials directory
Hosting resources
ASP site
Domain names
Progged
Maxi directory
bigarticle : free articles
A Code
Code N Tutorials
Get PHP
Programmers help




beginners PHP Copyright © 2004 onwards by beginnersPHP.