News Contact
Web Development Design UK USA India, Web Software Applications Development Programming Contact Custom Web Software Developers Programming Company India Contact Web Software Development Company Call Request For Web Software Development Programming RFI RFP RFQ Web Development Design UK USA India, Web Software Applications Development Programming Contact website development and web design company, advanced portal development UK USA Site Map: Internet applications to discover your NET potential
     


P
HP functions: An Introduction


PHP functions are used in every single script. Get acquainted with the PHP functions to create your own tasks.

<?php
explode(' ', $value1);
?>

These are built in PHP functions and they are the same and available on every PHP setup. You can access them in any script without needing to do anything special.

A function is a subprogram that can act on data and return a value. Each function has its own name and when that name is encountered, the execution of the programme branches off to the first line (or statement) of that function. When the function has completed, it 'returns' and execution resumes from where it left off. A function will perform a specific task and does it well, returning the value you want with the arguments you pass to it.

For example:

array explode ( string separator, string string [, int limit])

This line is known as the prototype. It tells you exactly what the function is and what parameters it should be passed. We can see that it will return an array when you call it, and as parameters (the name of a variable usually passed to a function e.g $split and $string are the parameters in explode($split, $string)), it takes separator, string and limit. Parameters are always within the ( ). The first 2:

( string separator, string string [, int limit])

are required and you must pass arguments (the actual value of the parameter e.g ' ' and 'split this up' are the arguments in explode(' ', 'split this up') ) for these when you call the function. If you do not specify a separator or a string, you will get an error. The parameters must also be passed in the order they are listed here. You cannot swap them around.

However, there is the limit parameter at the end:

( string separator, string string [, int limit] )

Notice how this is within [squared brackets]. This means it is optional. You do not need to pass that parameter to the function.

The return and parameter types (highlighted below) are not really important in most cases.

array explode ( string separator, string string [, int limit])

PHP is known as a loosely typed language which means you do not need to worry about variable types. PHP will do the work for you. In the case of explode() , you know however that it will return an array when it is completed and you have to pass it 2 strings. You would get an error if you tried to pass it an integer:

explode(1, 15117);

But generally speaking, you can safely ignore the types.

When calling the function, you can do several things with the result. For example, you could echo it directly to the page: 

echo explode(' ' , 'split this up');

Which wouldn't be much use. The most common thing you'd do is save the result in a variable like so: 

$split = explode(' ' , 'split this up');

You can then play with the data as you like because it is in the $split variable.

This article has been compiled by the content development team at Pegasus InfoCorp which pulls subject matter specialists from different work domains. They can be contacted through the Pegasus InfoCorp website at info@pegasusinfocorp.com. Pegasus InfoCorp is an India based web design, web development and online/ offline software development company. Please visit http://www.pegasusinfocorp.com to read more articles and know more about us!

Other companies and organizations are welcome to reprint this article on their websites provided the following conditions are met.

  • The article is not changed in any manner
  • The article is copied as is in its entirety (including back links to the Pegasus InfoCorp website).
  • The company/ organization reprinting the article agrees to defend, indemnify and hold harmless Pegasus InfoCorp, its employees, directors, officers, agents, partners and their successors and assigns from and against any and all liabilities, damages, losses, costs and expenses, including attorney's fees, caused by or arising out of claims based upon the use of the article, including any claim of libel, defamation, violation of rights of privacy or publicity, loss of service by subscribers and infringement of intellectual property or other rights.
 
php function,php string function ,Apple, Macintosh, Software, Games, Demos, Shareware, Freeware, PHP Function Reference, Reference widget for PHP developers,php date function ,php mail function ,php array function ,php function class
 
call a php function ,function index php,php function tutorial ,alert function in php,php time function Articles
server software, scripting languages, free, downloads, developers, dynamic web pages, e-commerce, optimizer, Blogs
diwali festival india, festival of light in india, festival film hindi in india, india festival of light, national festival of india India Info
   
   
 
compiler, open source, mySQL, ASP, Zend Engine, performance, tutorials, manuals, documentation, knowledge
 
base, products, articles, resources, tips, code gallery, script, archive, programming, business, technology, HTML Home
php, mysql, php templates, apache, php,manual, server, pdf, database, flash, phpbuilder, content management Featured Clients
system, sql, script, oracle, string, xml, regular expressions, php5,webalizer, php tutorials, code, nusoap, classes, developers Why Choose Pegasus ?
PHP, Unix, Linux, Apache, server software, scripting languages, free, downloads,developers, dynamic web pages, e-commerce, optimizer, Services
compiler, open source, mySQL, ASP, Zend Engine, performance, tutorials, manuals, documentation, knowledge Solutions
base, products, articles, resources, tips, code gallery, script,archive, programming, business, technology, HTML Contact Us
dhtml menu, javascript menu, free website, navigation system, dhtml web menu, right mouse click, cross browser dhtml menu builder, Site Map
 
software developer,bay developer software tampa, developer software tool,internet poker software developer,game software developer
 
software developer florida ,poker software developer,freelance software developer,developer multimedia professional software Rupali
indian software developer, real estate developer software,developerindia multimedia professional software,software developer jobs Port of Mundra
access developer software,software developer resume ,developer software,web developer software ,pda software developer Aus RFID
developer computer software,custom software developer ,developer ireland software ,microsoft access developer software Planet Bombay
offshore software developer,based developer india software ,developer educational software,web site developer software  Marlex
description developer job software,software developer salary ,software developer magazine ,software developer kit ICUIL
application developer software, java and developer and software ,online poker software developer ,developer resume sample software Steinmetz
palm software developer,software developer gambling,multimedia software developer,shopping cart software developer,wireless software developer,canada developer in looking software work,software developer career Smart Fashions
 
Read More
>>
 
 
© 2007, Pegasus InfoCorp Pvt. Ltd. All Rights Reserved. Install Shockwave Flash™