cialis vs viagracialis reviewsbuy cialiscialis pricegeneric cialiscialis onlinecialis side effectscialis dosagecialis pricecialis dailycialis side effectscialis wikipediacialis dosagecialis genericcialis onlinecialis levitra viagralevitra vs cialis reviewscialis dosagegeneric cialis reviewscialis vs viagraonline pharmacy reviewsviagra vs cialis reviewscanadian pharmacy reviewsenzyte reviewsbuy cialis without prescriptioncompare prices cialisbuy cialis online without a prescriptioncialis professionalcialis pricebuy tadalafilbuy generic cialisbuy viagracialis price walmartcialis onlinecialis vs viagracialis genericcialis dosageviagra pricecialis reviewscialis side effectsgeneric cialis reviewsdoes generic cialis workgeneric viagracialis dosagecialis onlinecialis vs viagrageneric drugstadalafilcialis online without prescriptioncialis pricecialis genericcialis vs viagracialis dosageviagra online without prescriptioncialis side effectscialis reviewscialis vs viagracialis dosagecialis drug interactionscialis levitra viagracialis or viagralevitra side effectscialis onlinecialis pricecialis vs viagracialis dailycialis side effectscialis onlinecialis pricecialis levitra viagralevitra dosageviagra dosageviagra online without prescriptioncialis side effectscialis reviewscialis vs viagracialis dosagecialis drug interactions

Though PHP is considered to be the easiest and the most popular programming language, web programmers still make mistakes (more particularly silly mistakes) and ultimately find out the fact that the code is not working at all. It is a sheer waste of working hour. Besides that, it decelerates the speed of work and thereby making it further difficult to deliver the output within stipulated time. If you were a newbie in the domain of web programming, there is a greater chance that you will commit some trivial mistakes at the initial stage. Therefore, if you remain aware of some common mistakes associated with PHP programming, you can make a better showing.

If you have gone through some PHP dedicated forums, some of you have certainly noticed that they are filled with the posts of “need urgent help ” or “please fix this bug” etc. It only reflects the fact that programmers (both experienced and inexperienced) commit mistakes and they started screaming for help at the very sign of it. Don’t press the panic button at the sign of a unknown error message, try to face the problem as patiently as possible because “Patience is virtue” after all.

Unexpected T_STRING

“Unexpected T_STRING” is considered to be the commonest error while developing a website on PHP programming language. If you have used this code:

<?php
$x=”he;
$y=”llo”;
$greeting=$x . $y;
?>

you have certainly faced this error message “Parse error: parse error, unexpected T_STRING on line 4”. In the above example, line four seems to be absolutely perfect but you have to understand the fact that though interpreters and compliers can track syntax errors, they are unable to interpret them accurately. From the point of view of programmer, you will trace out the fact that the error is actually located in line three because there is no double quote. However, the problem will emerge when PHP interpreter starts indicating error in line four. So, the only thing you can do in this situation is to exploit your reasoning power. So, don’t waste your time starting at line four and scratching your head for one hour to fix this problem next time.

Non-Fatal Warning Message

Don’t cringe at the very display of this message because it is a very common problem. A programing code like:

<? print “Non-existent variable: ” . $non_existent; ?>

will generate a notice similar like this:

Notice: Undefined variable: non_existent in /var/www/html/error_example.php on line 3 Nonexistent variable:

This error occur due to the non initialization of a variable – $non_existent. This problem can be debugged in several ways and the easiest of them is to initialize the variable by joining the line $non_existent=. Apart from that, you can opt for another alternative. By adding an if statement for checking whether or not $non_existent has been set in the coding, you can fix this error as well. However, these are not the types of problems that you should get alarmed at. This kind of problems can be fixed easily.

Mixing With Other Language
This is another common type of errors committed by web developers. In most of the cases, web programmers make serious mistakes while coding with multiple programming languages such as JavaScript and PHP. For example, if you use this code to create a JavaScript function to access PHP variables:

<script language=”JavaScript”>
<?php $name=get_name(); ?> document.write(name);
</script>

you are making a blunder. Before anything else, you have to comprehend the basic thing that each programming language has its unique codes or special characters and you can not use them in another programming language. In the case of above-mentioned example, a web developer has messed up with the document.write() call – $name and name. “name” is an invalid character in JavaScript but is a valid character in PHP language. Actually, the simple rule is that if you use code in a nonsensical way, you are bound to get nonsensical result. Therefore, the correct code would be:

<script language=”JavaScript”>
document.write(‘<?php echo get_name(); ?>’);
</script>

Some other common PHP mistakes will be published in the next section of this article.

One Comment

  1. [...] This is the second part of the Common PHP Programing Mistakes discussed in the previous section. [...]

Leave a Reply

*