Open Source Tutorials - Open Source Training
Open source training & tutorials from experienced, passionate people
chrome icon firefox icon ie icon opera icon safari icon Sings in these Browsers
A- A A+

By A Web Design

Welcome, Guest
Username Password: Remember me

Functions and Arrays
(1 viewing) (1) Guest
All your queries regarding
PHP Installation,
Binding Apache-PHP-MySQL,
and tonnes more... will be solved in this forum
  • Page:
  • 1
TOPIC:

Functions and Arrays

Functions and Arrays 9 months, 3 weeks ago #738

  • phplearner
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
  • Karma: 0
Hi All,

I am new to PHP and know basic language. I don't know how to practise PHP. Can anyone tell me how to play with functions and arrays etc. to be expert in php? Any hints for practice?

Thanks,

Re: Functions and Arrays 9 months, 3 weeks ago #750

  • nikhil
  • OFFLINE
  • Fresh Boarder
  • Posts: 19
  • Karma: 1
In PHP functions, a function will be executed by a call to the function from anywhere within a page.

Consider this example:
<html>
<head>
</head>
<body>
<?php
function getInfo()
{
echo "Successfull";
}

echo "PHP Function Execution:";
getInfo();
?>
</body>
</html>

Here, After the statement is echoed "PHP Function Execution" the getInfo function is called and "Successfull" gets prints.


In PHP Arrays, multiple value will be stored in one variable.
There are 3 kinds of arrays: Numerical, Associative and Multidimensional.
A numeric array stores each array element with a numeric index.
An associative array, each ID key is associated with a value.
whereas,
In a multidimensional array, each element in the main array can also be an array. And each element in the sub-array can be an array, and so on.

Consider this example:
<html>
<head>
</head>
<body>
<?php

$employeeID = array("John"=>B32, "Harry"=>C30, "Kate"=>A34);

echo "Employee ID of Harry is:" . $employeeID['Harry'] ;
?>
</body>
</html>

Hope you got the idea of executing Functions and Arrays in PHP.

Re: Functions and Arrays 9 months, 2 weeks ago #759

  • phplearner
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
  • Karma: 0
Thank you nikhil,

I have basic knowledge but i need some kind of tasks etc for practice.
Last Edit: 9 months, 2 weeks ago by phplearner.
  • Page:
  • 1
Time to create page: 1.49 seconds
OSV Newsletter


Receive HTML?

NOTE: To prevent subscription to the OSV newsletter, uncheck the checkbox above.
Guest Blog for OSV
Free Ebook Download