Embedding Comments

March 10th, 2010

Now, to make you a better programmer we all know the value of comments. This allows you to understand the code that you have written defining and given meaning to operations as you build them up. You start with the terminators used by PHP and end with them as well. Single line comments look like this �// comment� and Multi-line ones use the syntax /* comment comment*/. A better example would be the one below:

//comment
/* comment
Comment*/
?>

In the next post we take on the best parts of PHP which would be variables which is essential in all programming languages.

More into the syntax of PHP

February 10th, 2010

As you might have seen, all of the PHP statement ends with �;� which would be somewhat similar to Perl. The valid HTML code that was handed back to the server was :



Who are You?

My name is MacGyver.

More in the coming posts when we dig deeper as we widen our understanding of PHP.

PHP Basics

January 10th, 2010

Now that you have installed the necessary web server software and tested that it works (which is included in the manual) we can now get to know the basics of PHP. For our guide we will be using HTTP combined with PHP, this allows PHP code to be embedded into regular html pages and thus simplifying the execution by simply requesting the page. PHP uses start and stop tags in the form of “?php” and “?” and below is a sample:

".. PHP Code".
?>

The following sample has PHP code embedded within HTTP:



Fan: Who are You?

//print output
Echo "My name is MacGyver";?>

Upon execution or opening the page this would give you text in the browser stating the following words. “Who are You?” “My name is MacGyver“. This would be the equivalent hello world program many books use in teaching the basics of programming.

Array Chunk Function

December 11th, 2009

The array_chunk() function on the on the other hand as the name implies, divides an array into chunks or several tables from the source table. The syntax goes something like array_chunk(array,size,preserve_key), wherein the array is the table that would be divided, the size is the number of elements which the new arrays are to contain and the preserve key which can either be true or false is used to either retain or revise the key or pointer value of the original table. An example is shown below:

$a=array(�a�=>�Cat�, �b�=>�Dog�, �c�=>�Horse�,�d�=>�Cow�);
print_r(array_chunk($a,2);
?>

The code would have an output of:

Array (
[0] => Array ( [0] = > Cat [1] => Dog )
[1] => Array ( [0] => Horse [1] => Cow )
)

As we can see, the original array has been divided into two arrays array0 and array1 and a value that is not given for the key had it assigned a new key for each of the tables. Another example would be :

$a=array(�a�=>�Cat�, �b�=>�Dog�, �c�=>�Horse�,�d�=>�Cow�);
print_r(array_chunk($a,2,true);
?>

This would then give us ;
Array (
[0] => Array ( [a] = > Cat [b] => Dog )
[1] => Array ( [c] => Horse [d] => Cow )
)

This shows the significance of the retain key field wherein the two new arrays retained their original keys. The reverse of which would be the array_combine() which divided the array into one which holds the keys and one with the values.

Arrays : Changing cases

November 6th, 2009

This form of array declaration allows one to change the case from uppercase to lowercase and vice versa. The syntax goes as follows:

array_change_key_case(array,case)

The array part, specifies which table or array to use and is a required field which is not the case with the key which is automatically assigned a value. An example of it’s use can be seen below:

$a=array('a'=>“Mouse”,’b'=>”Rat”,’c'=>”Rodent”,’d'=>”Cat”);
print_r(array_change_key_case($a,CASE_UPPER));
?>

The output of the said commands will be:
Array ( [A] => Mouse [B] => Rat [C] => Rodent [D] => Cat)

Another example of it’s use would be:

$a=array('a'=>“Mouse”,’B'=>”Rat”,’c'=>”Rodent”,’b'=>”Cat”);
print_r(array_change_key_case($a,CASE_UPPER));
?>

That returns the following values respectively:
Array ( [A] => Mouse [B] => Rat [C] => Rodent [D] => Cat)

In the next post, we would discuss an array function that divides a large array into several chunks of separate arrays.

PHP Programming Tutorials & Tips

October 20th, 2009

One of the more popular technologies for web programming in the recent years owing to its open source technology is the PHP. And it only means that it’s free to use and also compatible with almost any server, say Windows, Linux/Unix and Apache. This technology has many advanced features included in it though its open source.

PHP programming jobs still in demand

September 15th, 2009

Technology Driven Marketing Solutions is an industry leading developer of PHP solutions who will become part of a dynamic and fast growing team. You may experience to make codes for a range of web applications by applying your PHP and OOD programming. Success in this field will lead to further career opportunities within the organization.

Templates and ready made Apps on the Web (Part 2)

August 25th, 2009

There are a lot of programmers who share code and sample applications which you can use for free (provided you clear it up first) but for budding programmers, they’re all there for the taking. Sites like <a href=”http://websitetips.com/php/”>websitetips.com</a>, <a href=”http://www.smartwebby.com/PHP/default.asp”>Smartwebby.com</a> and many other blogs and help sites allows access to tips from programmers like you making it a pleasant experience altogether. Can’t find a question, post questions to the many forums and you’ll get help from others in no time, you might even get help from the guru’s themselves who made the phenomenon that is PHP possible for all of us to use.

Templates and ready made Apps on the Web (Part 1)

July 21st, 2009

Thanks to the basic foundation on which PHP is founded on, the language being free of all legalities and other stuff that makes deployment of other languages on the many platforms quite expensive. But the many people who makeup the PHP community are not ones who keep knowledge to themselves for there are tons of free pre-made templates for applications and processes on the web available for programmers from all skill levels. They make it fun and easy to learn the language in no time and the community fosters growth to all of those who benefit from the use of PHP. Search online for help and you will surely get it in the form of forums and other helpful articles.

Galileo – Soon to Grace PHP

June 23rd, 2009

Galileo, an open-source framework that was developed by the Eclipse Foundation and sponsored by IBM is set for launch tomorrow. Hailed as one of the newest innovations to the development and deployment of open-sourced projects that is becoming more and more prominent with the internet of today. Eclipse is a non-profit organization that manages and maintains the many projects they are involved in, making them one of the biggest supporters of the open-source community. Read the rest of this entry »