lunes, 26 de febrero de 2007

Day 1 - PHP BASICS part III - Anatomy of a PHP Script

Resume

The Anatomy of a PHP script is formed by a serie of elements between highlight the next:

Comments

PHP offer different ways of to comment a code line in you script.

You can to comment a single line in shell style:

<?php
#This is a shell style comment
echo "hellow world!!!" ;
?>


You too, can to comment a single line in C style:

<?php
//This is a C style comment
echo "hellow world!!!" ;
?>



Or you can to comment a lot of lines in you code in the next way:

<?php
/* This is a multi line comment
that we would can to use!!!
*/
echo "hellow world!!!" ;
?>


White spaces

PHP is a white spaces insensitive language that let us to use the spaces that we needed, except that definition for some cases.

Code Block

All code into a function, condition or loop that is formed for more one statement will need to use branches, for example:

<?php
if(x == 1 ){
echo "hellow world!!!" ;
}else{
echo "nothing";
}
?>


Language Construct

They are all function own of the language.

Lab Practices

In developing...

sábado, 24 de febrero de 2007

Day 1 - PHP BASICS part II - Syntax

Resume

PHP is a programming language and programming environment for to develop of web application, scripts and much more!!!

PHP is supported by php community and the Zend company.

PHP meaning "
PHP: Hypertext Preprocessor" and was written by Ramus Lerdorf in 1994 and was improve by Zeev Suraski and Andi Gutmans, two Israeli developers at the Technion - Israel Institute of Technology in 1997.

The syntax of the PHP language is very simple and is very seemed to C or PERL language.

Is possible to embedded PHP instructions in any type of file for to be processed by the PHP compiler. The PHP compiler search all PHP instructions into of the file that begin with the PHP opening tag and executed the instructions even that find the PHP closing tag.

Exist four types of PHP opening and closing tags:

1.- In the standard way:

<?php

echo 'if you want to serve XHTML or XML documents, do like this';

?>

2.- As processing instruction:

<script language="php">
echo 'some editors (like frontpage) don't like processing instructions';
</script>


3.- Short tags:

<? echo 'this is the simplest, an SGML processing instruction'; ?>
<?= "hi world" ?> this is a shortcut



4.- ASP style tags:

<% echo 'You may optionally use ASP-style tags'; %>
<%= "hellow world!"; %>


For to use short tags and ASP tags will be need that you enabled the next directive in the configuration file "php.ini": short_open_tag and asp_tags.

short_open_tag = on
asp_tags = on

In PHP also as in C or Perl, PHP requires instrutions to be terminated with a semicolon at the end of each statement.

Surrounding at the newline characters is important to know that all character out of the php tags is out putting and will not be processed by the php compiler but they possibly will affect the http headers generating an error.

Conclusion

Today we learned the basic syntax of a php script.

Lab Practices.

In developing...

Day 1 - PHP BASICS part I

Objective.

In this day, we'll try to understand all the basics elements related with the PHP language.

Contents.

1.- Syntax -> view
2.- Anatomy of a PHP Script -> view
3.- Data Types
4.- Variables
5.- Consts
6.- Operators
7.- Control Structures
8.- Errors and Error Management

Abstract.

In developing....


Resources.


Zend PHP 5 Certification Study Guide - Chapter 1 - PHP Basics

PHP Manual by the PHP Group

PHP Tutorial by w3schools

Lab Practices.

In developing...

Welcome Message

Hi all my friends! My name is Edwin Sandoval, I am a teacher of the Santiago Institute of Technology in Durango, Mexico and I'm working very hard in order to obtain the Zend Certification for the PHP language.

This blog has as aid to help your in the road of to obtain the Zend Certification related with the popular language named PHP 5.0

In this page your will find all the material related with my experience obtained in the road of to pass in successful way the ZCE test.

The material in this page will be divided in two subjects: the teoric background found and recommended by myself and my own workshop material generated.

The modality of this blog will be of a one hour of work daily and we will finish the day that we publish the last item with the success full result of the test.

That's all my friend and go for the ZCE!!!