Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Introduction to PHP

Links for php scripts

Moderators: macek, egami, gesf

Postby Alexej Kubarev » Thu Jun 23, 2005 7:26 am

First of all: Welcome :D
---------------------------------
Well... you know: the best thing to get a manual would be http://www.php.net itself :)

Some pretty good articles could be found at http://www.zend.com by going to their developers section and taking a look at absolute begginers.
http://www.phpbuilder.com has some tutorials as well
http://www.devshed.com is a bit more advanced and may be usefull to you a little bit later..

There are tons of different books available and some of them could be found for free :)
http://betah.co.il/books/May2005/Web%20programming%20%20-%20OReilly%20-%20Learning%20PHP%205.rar is something that might be usefull...

the basix syntax is pretty easy to understand:

all php code is placed between PHP tags <?php and ?> there is an alternative to <?php called php short tag and it looks like this: <?
but on some servers those short tags might not be allowed..

all the variables are starting with $ sign. You will also need to put ; at the end of each opertaion. The syntax is simmilar to C++ and C# but you dont need to define the variable type as php will dot hat for you:

Code: Select all
<?php
$var = "Hello there!";

if( $var != "" )
{
   echo ("This is your variables value: ".$var);
}
else
{
   echo ("Please define a variable");
}

?>


All of this is really nothing and hard to understand so please take a look at those links i gave you as they might become usefull :)
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Postby nomenclator » Thu Nov 09, 2006 7:19 pm

If you are just starting out I would recommend http://webmonkey.com/webmonkey/01/48/in ... rogramming as one of the least muddily written tutorials.

The most significant thing about php is that when used on the web, it is a server-side language. The program is executed by an interpreter program on the web server computer, as opposed to being executed on the client's computer that the web site visitor is using to browse the web. Thus people will not be able to see php code when they do (in MSIE) View > Source. They will just see the html code that the php program, on the web server, creates, and then transmits over the web. This is like Perl, and in contrast to JavaScript, which is client side: the web site visitor's browser contains the JavaScript interpreter program that interprets the javascript code. A difference between php and Perl is that php can be embedded right in the middle of html code. Usually you have to make the file extension be php instead of htm or html. Despite using the php extension, you will use the <html> <head></head><body></body> </html> sections as usual, in your file, and then, as Alexei Kubarev mentioned, use <?php [php code here] ?> to embed php code in your html file - it is important to note that this php code is embedded between <body> and </body>.

Because it is server side, you won't have a php interpreter on a home computer that doesn't have a web server. That means to run php programs you will have to upload them to a web server that has a php interpreter, or, to run them on your home computer, you will have to download and install an apache server, and then download and install php. Both are open source and freely available. While the installation of both is easy, the setup and configuration can be rather confusing. You may have to use google to hunt around for plain-language instructions for setup and configuration.
nomenclator
New php-forum User
New php-forum User
 
Posts: 25
Joined: Thu Oct 21, 2004 8:10 am
Location: Eastern Long Island, NY, USA

Welcome!!!

Postby ramesh » Mon Feb 12, 2007 10:01 pm

So you are new to PHP world.Nothing to worry about.
I have also very new history of PHP but i hope i know something not null.
As said by the two frens,the language is actually not so difficult.If u have earlier programming experiences in languages like C or C++ etc then it would be advanatageous for you.
First u should desire then everything is maintainded by GOD but do work yourself that is not done by anyone for you.

First try to configure your system to able to understand PHP scripts that is done by configuring apache for your browser or using any tools.
Then u can use any sorts of editors -notepad,vi,wordpad,textpad etc to write the scripts
LAter u might need the database server to do database related programming,u can use mysql server,Oracle server,MSSQL server etc

Try the following in hte editor:
<?
print"This is my first programm";
?
The <? and ? are the delimiters in the program to indicate start and ending of the script.
Save this file as first.php
manage the server properly and browse for the file
The output will be:This is my first programm

Variables:
No datatype declaration required:
Ex:$a=10,$a="Sita"; all are possible

For arrays u can use:
$name[3]=("A","B","c");
print"$name[1]"; then prints A
and so on

More references will be available at:www.php.net and others.
User avatar
ramesh
New php-forum User
New php-forum User
 
Posts: 39
Joined: Sun Dec 10, 2006 2:00 am
Location: POKHARA


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.