PHP BASIC – Functions, Parameters, Argument and Advance Variable

php_developmentWe are going to see about php functions. The perfect programming is through functions. Because which is having lot of advantages while programming.

Function Advantages:

  • You reduce code duplication.
  • You can reuse code across scripts
  • You can write complex code more easily
  • You can reduce errors in your code

There is more..

To Create Functions:

to make function is simple, here is the syntax for that,

function functionName()
{
code to be executed;
}

Simple Eg,

<!--?php
function writeName()
{
echo "niyaz";
}

echo "My name is ";
writeName();
?>

PHP Functions – Adding parameters Continue reading

Advertisements

PHP Tutorials for beginners – Variables

php variableHi Friends, Hope you are doing well. I believe that you have gone through our previous PHP tutorials and get some ideas. That is fine. Today we are going to talk about PHP Variables.

PHP variables as containers for storing data.

Rules for PHP variables:

  • A variable starts with the $ sign, followed by the name of the variable.
  • A variable name must begin with a letter or the underscore character.
  • A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ).
  • A variable name should not contain spaces.
  • Variable names are case sensitive ($y and $Y are two different variables).

OK. Do not get sleepy, If you go for example you can easily understand what is variable.

For eg 1:

<?php
     $a = "Hello, ";
     echo $a;
?>

Check this output in your localhost, it will show Hello. 

This is it, Here $a is a variable, which contains hello value into that. Like that way we have to use php variables.

Eg 2:

<?php
       $v = 2500;
       $x = 7500;
       $y = 5000;
       $z = $v+$x+$y;
       echo $z;
?>

Do this practice in your localhost. Now you can get clear view about these variables.

Notes:

We do not initiate data type in PHP variables. It automatically converts the variable to the correct data type, depending on its value.

If you use alphabets, make double codes (in between that). for example ( $name = “hello word, how are you”; ) and should end with semi colon.

PHP has four different variable scopes. We will see about those in next tuto’s.

Thanks for reading. Post your comments.

PHP Tutorials for beginners – 2

Hi Guys, Hope you guys have successfully installed xampp server or wamp server in your computer. That’s is fine, Still If you have confusion go back to our previous tutorial or put your queries

in comments section, I will try to update you. As I told you earlier PHP is a server-side scripting language designed for web development. It is influenced by C, C++, Perl and Java. For this PHP implementation you must know basic programming about C language coding. If you are good in C or Java, Which is very easy to implement. PHP commands can be embedded directly into an HTML source document rather than calling an external file to process data. You can make a full php code to output. Like that way we are going to develop.

PHP codes must start with <? and ends with ?>. In between these we should put our code.

OK let us start our first php program here. Open any editor like notepad, notepad++, intype etc. which is your favorite in your system, do write following eg codes.

Eg 1:

Assume we should display Hi everyone, This is a beautiful world with beautiful people. we are going to display this sentence through PHP. Continue reading

PHP Tutorials for beginners – 1

php-logoHi Friends, There are billions of websites and applications are available on the web. Lot of programming languages to be used to develop web like Html,  PHP, ASP, JSP etc. Nowadays PHP is a very powerful and familiar web programming language even though which is open source. We can do anything through PHP on the web. I would tell you very familiar web giants Yahoo, Facebook, YouTube etc…. are using PHP. Why I am telling this is, from this post on wards I am going to write about some PHP programming language based tutorials. I believe that coming tutorials would be helpful for freshers, web developers and the people who are wanted to learn about PHP web programming simply. In coming sections we gonna discuss about web designs, developments and practical projects and so on.

Why PHP?

  • Which is an open source server side programming language available at free of cost.
  • Very efficient on multi-platforms like Windows, Linux, and UNIX etc..
  • Suitable for developing dynamic web pages
  • We can develop from small websites to giant business and organizational websites, informative forums, chatting platforms, CRM solutions, e-commerce shopping carts, community websites, e-business, shopping carts and gigantic database driven sites. Moreover, data handing has also been pretty handy in PHP in which the programmers can easily store data, serialize, creating cookies, calculating viewers by cookies and sessions and excellent file management system.
  • Flexible for the clients in terms of Budget and all.
  • 40% of websites are running through PHP programming.
  • Familiar faces using PHP is Facebook, Yahoo, YouTube, WordPress etc.

Ok enough about PHP stories. Lets start our practical appliance,

How to install PHP on your local PC?

Continue reading