PHP Programming 101

October 29th, 2014

PHP BASIC CODING (cont…)

(cont….)

V. Operators in PHP

*Arithmetic Operators*

+ addition
- subtraction
* multiplication
/ division
% modulus (division remainder)
++ increment
– decrement

*Comparison Operators*
== equal to
!= not equal
> greater than
= greater than or equal
<= less than or equal

*Logical Operators*
&& and
|| or
! not

I know its self explanatory…

VI. IF….Else Statements

If (condition)
//*Things to be executed if the answer to the condition is true*//
else
//*Things to be executed if the answer to the condition is false*//

If…else statement is use if the user wants to execute a set of code when the condition is true and another if the condition is not true.

VII. Switch Statement

switch (expression)
{
case 1:
//*code to be executed*//
break;
case 2:
//*code to be executed*//
break;
default:
//*code to be executed*//
break;
}

Switch statement is use if you want to select one of many blocks of code to be executed. this statement is used to avoid long blocks of if…elseif..else.

VIII. Looping Statement

while(condition)
code to be executed;

While statement is used to execute a block of code if and as long as a condition is true

do
{
code to be executed;
}while (condition)

Do—while statement is used to execute a block of code at least once and it will repeat the loop as long as the condition is true.

for each (array as value)
{
code to be executed;
}

For each statement is used to loop through arrays.

I think this is already enough and it has added new knowledge to those who are new in PHP… good luck and happy coding…

php_2.jpg

image source: www.cass.rrhosting.com

October 22nd, 2014

Automated Testing

Posted by Hannah in Programming

robotAny programmer knows that you need to test your code before it is declared ready. And while the coding part can wring your brains out, it is during the testing and debugging phase that things can really get frustrating. However, unless you want to be known for buggy programs, there’s nothing you can do but go through the testing phase.

One way to make your life easier is to automate the testing instead of doing it manually. This is especially true if you need to do exhaustive time-consuming test runs to run repetitive scenarios. Using automated testing will help you get more reliable results at a faster rate, usually meaning savings in terms of human capital and financial resources.

However, automated testing does require you to spend time and resources initially for the test programs are written. The more sophisticated the test program you need, the more resources you will need to spend on it. You can say that you need more than just basic programming skills for this. So before you do jump on the automated testing bandwagon though, you need to weigh the scope of your project to see whether you will really benefit much from automated testing or if manual testing will do.

Image via Crystal

October 15th, 2014

Select multiple HTML tag

Posted by editor in Codes, Information
Tips to simplify your life

Tips to simplify your life

Want to select multiple items from a list? Then you need to use the select multiple tag in HTML. The action handler then takes care of the form when the items are passed through it. What happens though, is that all of them are passed with the same widget name.

For example:
<select name=”var” multiple=”yes”>
The option you select will register with the action handler as var=option1, var=option2, var=option3. This thereby overwrites the previous $var variable’s contents.

The fix is to utilize the “array from form element” feature of PHP.

Use it like so:
<select name=”var[]” multiple=”yes”>
The first item then becomes $var[0], and then $var[1] for the next, and so on.

Hope this <a href=”http://phpprogrammingtips.net/information/looping-statements-doesnt-loop/”>tip</a> helps.

October 8th, 2014

PHP Browser Checking Script

Posted by Conrad in Basic Programming, Information, PHP

Several factors are to be considered should one be involved with deploying projects over the internet. One of the things you could do would be to have a nifty script that checks for the particular browser your clients might be using. This can be done with a simple and short piece of code that can mean the difference between a successful deployment without problems allowing proper extensions and plugins to be included. A sample of the code can be seen below for your reference which makes it easier for your program/web page to know which set of scripts and what parameters to adhere with. (more…)

October 1st, 2014

The Client side and Server Side Validation (3/3)

Posted by Edi in PHP

The Server-side data validation
The Server-side data validation means utilizing PHP to verify if good values have been sent to the script. Using server-side validation has almost the exact opposite advantages and disadvantages of client-side development:
Yes, it is more secure and works perfectly with all browsers, but it does so at the expense of slightly higher server load and slower feedback for users.

One big advantage of server-side validation is that you can use PHP – a language in which you have already familiarized with by now.
PHP has a wide variety of functions and language features modify strings, check numbers are within ranges, and so on. In addition to this, you can use PHP to connect to a database to check whether a username exists, for example, which is obviously impossible using client-side scripting.

September 24th, 2014

Marketing Your Skills as a Freelance Programmer

The popularity of PHP as a solution for websites with dynamic contents has created a huge market for people skilled enough in writing complex applications in PHP, covering a wide range of solutions. If you think you’ve got enough experience under your belt, you’ve probably already considered the idea at least once. However, simply knowing how to write good PHP scripts won’t be enough to make it as a successful freelance programmer. This post is a bit more abstract as it doesn’t cover programming specifically, but more general ideas that can help you get a better exposure for your skillset.

First, consider your weak points – this is crucial when aiming to be a successful freelancer. With a highly competitive market like the one we have, you simply can’t afford to lack in any qualification when it comes to writing PHP scripts. If your knowledge of database interaction is weak, you’d better grab a book on databases and dig in for the next few weeks – otherwise, that other guy who doesn’t write scripts quite as well as you, but knows MySQL by heart will keep getting the good jobs and you’ll keep treading in the same place.

Also, figure out what exactly you want to offer as a service – the applications of PHP are quite varied and this allows you to specialize in a particular type of design. Figure out what you do best and market yourself to that crowd – it’s always better to offer the type of service you’re best at (something which really shouldn’t even need mentioning, but somehow keeps getting ignored by many people).

September 17th, 2014

Learning PHP on a Budget

Posted by Hannah in Reference And Education

php programmingHigh education costs have discouraged many a would-be student from taking up college courses, afraid that tuition fees will land them in deep financial debt. While taking up a computer-related major may not be as expensive as pursuing a medical degree, expenses can still be too steep for many. However, if you wish to learn to program but do not have the budget to get enroll full-time in college, you can start by learning just one program at a time and see where it takes you.

Learning PHP is a good place to start since it is one of the most in demand programming languages in the IT industry these days. There are lots of free tutorials and budget-friendly courses for those who are tight on finances as well. Once you are well-versed with the language, you can then take certification tests to prove your expertise and use that as your credentials as a PHP programmers. You can then take your programming career from there, by getting more experience, attending trainings, and maybe even getting a full-blown degree eventually going beyond PHP to other programming languages.

Image via Yuko Honda

September 10th, 2014

Zend continues to Grace the PHP Scene

Posted by Conrad in Information, PHP

ZendOne of the best companies that have been developing tools for PHP, Zend has continued to provide solutions such as development tools and community resources to help developers and budding programmers the world over. Their enterprise edition ZendCore offers developers the stacks they need along with the tools you get from their web site to get you down and fast to developing web applications and pages in minutes. Ideal for enterprise applications, they offer valuable enhancements to the development stage with tools and many other useful tips for all. (more…)

September 10th, 2014

SERVER REVIEW: APACHE vs. IIS (cont…)

Posted by binary in PHP

(cont…)

On the other hand, Microsoft’s Internet Information Server (IIS) is a group of internet servers which has additional fetures for Microsoft operating system such as Windows NT and windows 2000 operating system servers. IIS can’t use Java, Perl and PHP on a .Net platform because Microsoft doesn’t support those technologies but Web developers can use Microsoft’s Active Server Page (ASP)technology otherwise. IIS has server administrators which include console from which all services and users can be administered. According to www.microsoft.com “I IS 6.0 which is redesigned with a new fault-tolerant process architecture that greatly boosts the reliability of Web sites and applications. IIS 6.0 isolates Web sites and applications into self-contained units called application pools, which separate applications from the other applications that are hosted on the same server.” Now i give you free hand to choose on what server you want to use? IIS or APACHE?

ssl-iis51.gif

Image Source: www.trustis.com

September 3rd, 2014

PHP is for Everyone

Posted by Conrad in PHP, Programming

PHP Made Easy

Whenever we say programming, it all comes down to limiting it to the actual programmers who have fought long and hard to make sure that they are up to date with the latest software the technology world has to offer. While this is only normal, many people have had their curiosity aroused on PHP to the extent of trying to learn it through the use of simple logic.

PHP programming is similar to any other scripting language we have heard of. The only difference here would be the commands to be used. If you sum it all up, it all boils down to desire and logic while also familiarizing yourself with the new commands and lines that PHP software uses today.

Next Page »