123ArticleOnline Logo
Welcome to 123ArticleOnline.com!
ALL >> Technology,-Gadget-and-Science >> View Article

Some Php Functions You Must Know

Profile Picture
By Author: Zareef Ahmed
Total Articles: 2
Comment this article
Facebook ShareTwitter ShareGoogle+ ShareTwitter Share

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

Total Views: 134Word Count: 572See All articles From Author

Add Comment

Technology, Gadget and Science Articles

1. How A Us Food-tech Startup Validated On A Data Sample
Author: webdatascrape.us

2. How Intrusion Detection Systems Help Organizations Strengthen Cybersecurity
Author: Devendra SIngh

3. How The Right Microsoft 365 Licensing Strategy Can Reduce Business Costs
Author: Devendra SIngh

4. How Safe Is A Luxury Paying Guest In Bangalore For Students And Professionals?
Author: ashiaana

5. Mapping Us Competitor Store Locations At Scale
Author: webdatascrape.us

6. How To Build Ai Video Generator App?
Author: davidjohnsen

7. The Impact Of Machine Kinematics On Aerospace Component Accuracy
Author: Harish Senapati

8. Beginners Guide To Artificial Intelligence (ai) Marketing
Author: VPS9

9. Scraping Fliggy Travel Data For Smarter Travel Insights
Author: Actowiz Solutions

10. Email Forensics Explained: How Security Teams Identify Suspicious Messages
Author: Devendra SIngh

11. Xiaohongshu (red) Data Scraping Api — Real-time Note, Creator & Product Tag Data | Real Data Api
Author: REAL DATA API

12. Maintaining Tight Tolerances With Advanced Multi-axis Machining
Author: Harish Senapati

13. Pinduoduo Data Scraping Api — Real-time Group-buy Price & Product Data | Real Data Api
Author: REAL DATA API

14. How To Deploy Llms On Gpu Dedicated Servers
Author: VPS9

15. Is Wordpress Website Down?
Author: Scope Hosts

Login To Account
Login Email:
Password:
Forgot Password?
New User?
Sign Up Newsletter
Email Address: