Main Menu
Articles Home
Most Popular Articles
Top Authors
Submit Articles
Submission Guidelines
Link to Us
Bookmark
Contact Us



Partners
 
Home / Technology

Some PHP functions you must know

By:Zareef Ahmed


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



Digg del.icio.us Blink Stumble Spurl Reddit Netscape Furl

Article Source: http://www.articles2k.com


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




Top Technology Articles
  • 1). Sound Proofing Techniques  By : Barney Garcia
    Are you frequently disturbed by different sounds entering your room while you are working or sleeping? It is then time for you to take a look into the different sound proofing techniques.

  • 2). The Market for Used Business Phone System Equipment  By : Kingston Amadan
    Business phone systems and the companies who sell them exist in a world all their own. The competition is stiff, with several different retailers and wholesalers carrying the same brands. The competition for used and refurbished business phones and business phone systems is even fiercer, as many companies are searching for equipment that can be used to expand their current system.

  • 4). Elevator Action  By : James Monahan
    Elevators are enclosure or platforms that are operated by cables, motors and other equipment or accessories enabling the vertical shaft to go up and down, and transport people, freight or both.

  • 6). Pagers - How Do They Work?  By : Trevor Dumbleton
    How do those beeping things work that people carry around on their belts? There are several types of pagers but, basically, it’s all done by good, old- fashioned radio waves. Someone sends you a text message with a touch-tone phone – or it can also be sent by email – and the message is forwarded to the thing on your belt, which then emits a beep or vibration to tell you you’ve got a message.

  • 10). The Decision: A True Story  By : Dr. Dorree Lynn
    Part Three Of A Series On Psychotherapy Once you have made the decision to find help, be wary of "fast-food solutions," the "McDonalds" type of psycho


New Technology Articles
  • 1). Which Online Gaming Console Is The Best?  By : Gregg Hall
    Computers used to be the only way to access the internet and game online, now you can hook up most gaming consoles. Access to other gamers through the internet has brought gaming to another level, making competition for the best gaming console fierce.

  • 3). HDTV Introduction  By : DavidZ
    Are you looking to buy a HDTV? Take a look at our guide to find out what HDTV is about. 1. What does HDTV stand for? High Definition Television 2. What is HTDV? It is a new technology and way of filming that has a higher bit depth resolution and gives you a sense or realism while watching the program. Sports are one of the leading industries in high definition programming.

  • 4). Perform Conference Calls Without Having Prior Reservations  By : Amporn Saechin
    Other teleconferencing services allow subscribers to perform conference calls without having prior reservations. If you're looking for conference bridgeline services or conference recording services, I highly recommend e-Teleconferencing. Unlike other automated teleconferencing services, ReadyConference gives you a permanent dial-in number and passcode you can use any time, from anywhere - 24/7.

  • 5). Amazing Communications  By : Analeese Burnabaker
    As history has progressed and technology has continued to advance, life has become full of more and more good things. Without a doubt, one of the best things that our society has gained from the advances of technology is communications. Consider for a few moments all of the amazing forms of communications that have made your life easier and more full.

  • 6). A Look At Cordless Phones  By : Angel Estrella
    Cordless phones, also known as portable telephones, use a wireless handset in order to communicate with the phone’s base, which is connected to a telephone landline. In order for cordless phones to function properly, they must be used within a specified proximity to the base. Most individuals find that they can use their cordless phones throughout the house or in the yard without interruption.

  • 7). Send Greetings For Better Communication  By : CD Mohatta
    Greetings are probably as old as the civilization. People always greet each other whenever they meet or talk. A good morning, hello, how are you, how are things at your end, etc are some of the common ways to begin the conversation. A greeting in everyday life connects us better with another person. One generally does not immediately come to the subject matter without a greeting in almost all meetings.

  • 8). Pagers - How Do They Work?  By : Trevor Dumbleton
    How do those beeping things work that people carry around on their belts? There are several types of pagers but, basically, it’s all done by good, old- fashioned radio waves. Someone sends you a text message with a touch-tone phone – or it can also be sent by email – and the message is forwarded to the thing on your belt, which then emits a beep or vibration to tell you you’ve got a message.

  • 9). Palm Treo: Getting Started With Your New Treo Smartphone  By : Christopher Meinck
    Copyright 2006 Christopher Meinck Getting Started With a Palm Treo Smartphone For many, adding a Palm Treo smartphone to their life is an exciting time. Most are coming from a traditional cellphone and the capabilities of a smartphone never seize to amaze. The Palm Treo features a large color LCD screen, full keyboard and software for syncing your personal data with your PC or Mac.

  • 10). Cheap Prepaid Calling Card - Making The Work For You  By : Melissa Wayan
    So most prepaid calling cards are cheap prepaid calling cards. I mean when you think about it, the calling cards really are significantly cheaper than the cost of calling from a landline. My parents pay around 20 cents a minute to call me and I have found calling cards from the United States to Venezuela for a low at 3 cents a minute. I found most of these online.



 


© 2006 articles2k.com - Privacy Policy