Archives for August, 2010
Posted on 2010 under PHP |
6
Aug
A variable is something for storing information.
Variables in PHP
Variables are used for storing a values, such as arrays, numbers or text strings.
Once a variable is declared, it could be used in your script, over and over again.
In PHP, all variables start with a $ (dollar) sign symbol.
Below tells how to correctly declare a variable in PHP script:
<?php $var_name = value; ?>
If you forget the $ sign at the very beginning of your variable, your variable will not work.
Below, we declare a variable contains a number and a variable contains a string:
<?php
$txt = “Hello World”;
$number = 16;
?>
PHP is a loosely Typed Language
In PHP, users do not need to declared a variable before adding any value to it.As what showed above, users do not need to tell the PHP what kind of data type the variable is.PHP is able to converts the variable for the correct data type, all depending on the value of variable.In some other strongly typed programming language, users need to declare the data type and name of a variable before using it.
In PHP, variables are automatically declared.
Rules for Naming Variables
A variable in PHP must be started with an underscore”_” or a letter
A variable name only contains underscores and alpha-numeric characters (0-9,a-z, A-Z, and _ )
A variable can not contain spaces. In case, a variable contains more than one word, users can separate it with capitablization ($myString) or with underscores ($my_string)
Posted on 2010 under PHP |
3
Aug
PHP is a server side language, PHP code is only executed on the server end, and return plain HTML result to the browser.
Basic PHP Syntax:
PHP scripting block starts with <?php and ends with ?>
<?php ?>
A PHP scripting block is allowed to be placed anywhere in a PHP document.
You can start a PHP scripting block with <? and ends it with ?>, but these shorthand is not recommended.
<?php
?>
A PHP file is allowed to contains some HTML tags, simply like an HTML file, as well as some PHP scripting code.
What you see below is a very simple PHP script, which return to the browser a text “Hello World”:
<html>
<body>
<?php
echo “Hello World”;
?>
</body>
</html>
Each line of code in PHP requires ending with a semicolon.The semicolon is somehow like a separator, it tells the server to distinguish one line of PHP scripting from another.
There are two statements for outputing PHP text: echo and print, as what you read, we have used echo statement to output the “Hello World” text.
Note:Your PHP file must have a .php extension, otherwise, the PHP code can not be executed.
Comments in PHP:
In PHP, there are two types of comments:
// for making a single-line comment, while /* and */ for large comment block.
<html>
<body>
<?php
// This is a comment
/*This is
a comment block
*/
?>
</body>
</html>
Posted on 2010 under PHP |
3
Aug
What do you need?
You need a server which supports PHP, if you have a server with PHP supported, there is nothing to worry.If you buy a web hosting, most servers support PHP, so you just need to upload your PHP files to your web directory.In case, you server does not support PHP.You need to install it.
You can follow the official PHP5 installation tutorial: http://www.php.net/manual/en/install.php
Where to download PHP?
Download PHP for free: http://www.php.net/downloads.php
Where to download MySQL database?
Download MySQL for free: http://www.mysql.com/downloads/index.html
Where to download Apache Server?
Download Apache for fre: http://httpd.apache.org/download.cqi
Posted on 2010 under PHP |
3
Aug
PHP Language is a server-side scripting language, which means you need to upload your PHP files to your server before any execution.
Before Learning PHP:
Before learning some PHP, you should have a basic idea of the following language:
If you need some knowledage for HTML/XHTML and JavaScript, check out home page for related tutorials.
What is PHP?
PHP means PHP: Hypertext Preprocessor, it is a server-side scripting language, just like Microsoft’s ASP, you need to upload your PHP scripts before execute them.PHP supports many kinds of databases (MySQL, Generic ODBC, PostgreSQL, Solid, Sybase, Oracle, Informix, etc.)PHP is a very open source software, whenever need help, you can check the official website PHP.net, the last thing, PHP is a free software for download and use.
What is a PHP File?
- PHP files allow text, Html scripts and PHP scripts
- PHP files can be executed and returned to browser plain HTML
- PHP files have extension of “php”, “phtml” or “.php3″
What is MySQL?
- MySQL is a database server
- MySQL is perfect for tiny, small and large web applications
- MySQL supports for standard SQL
- MySQL supports for lots of platforms
- MySQL is totally free to download and use, you can download Mysql from the official website: www.mysql.com
PHP + MySQL
- PHP plus MySQL supports many platform (you can use serve on a Unix platform and Windows)
Why Choose PHP?
- PHP supports many platforms (Unix, Linux, Windows, etc.)
- PHP is compatible with most servers nowadays (IIS, Apache, etc.)
- PHP is totally free to download from official PHP website: www.php.net
- PHP is very easy to learn and runs efficiently on php server side
Where to Start Learning PHP?
To get access to PHP supported web server, you can:
- find a web hosting plan with MySQL and PHP supported
- Install IIS ( or Apache ) on your own server, install MySQL and PHP
Posted on 2010 under PHP |
3
Aug
PHP is a very powerful tool for developing dynamic and interactive web pages.It is widely-used in many website, and much efficient alternative to Microsoft’s ASP among many other competitors.And last thing, PHP is totally free.
In this PHP tutorial, we are much pleased to let you know about PHP, and how to run excute PHP scripts on your PHP server.
PHP References:
At infonetguide you can find all the references of PHP functions:
- Array functions
- Calendar functions
- Date functions
- Directory functions
- Error functions
- Filesystem functions
- Filter functions
- FTP functions
- HTTP functions
- LibXML functions
- Mail functions
- Math functions
- Misc functions
- MySQL functions
- SimpleXML functions
- String functions
- XML Parser functions
- Zip functions