Run the below given command
sudo apt-get install php-pear
Run the below given command
sudo apt-get install php-pear
Run the below given command
sudo pear install PHP_CodeSniffer-1.3.4
Makes sure that the the server has got php pear installed in it
If php pear is not installed run the below given command
sudo apt-get install php-pear
PHP_CodeSniffer is a PHP5 script that tokenises and “sniffs” PHP, JavaScript and CSS files to detect violations of a defined coding standard. It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers.
A coding standard in PHP_CodeSniffer is a collection of sniff files. Each sniff file checks one part of the coding standard only. Multiple coding standards can be used within PHP_CodeSniffer so that the one installation can be used across multiple projects. The default coding standard used by PHP_CodeSniffer is the PEAR coding standard.
PHP_CodeSniffer requires PHP version 5.1.2 or greater.
it can also be used to define a set of Coding Standards for your project.
Foreach loops are more simple and appropriate for Associative arrays and when you don’t have to keep track of iterations. For Indexed arrays, For loops are more appropriate since their incrementers are nicely associated with the keys of Indexed arrays.
Foreach loops are more simple and appropriate for Associative arrays and when you don’t have to keep track of iterations. For Indexed arrays, For loops are more appropriate since their incrementers are nicely associated with the keys of Indexed arrays.
While is an entry control loop where do while is an exit control loop so Do While loop runs at least once even when the condition is false.
Do While executes the condition one time less than While.
While is an entry control loop where do while is an exit control loop so Do While loop runs at least once even when the condition is false.
Do While executes the condition one time less than While.
Foreach loop acts only on arrays and acts similar to For loop. Difference is you don’t have to define an incrementer and increment it. There is also no condition to evaluate. It would run for each item in the array and won’t run at all if the array is empty.
Syntax
foreach (array as value) {
block of codes
}
Example
<?php
$array = array(1,2,3,4,5);
foreach($array as $value)
echo $value.” t”;
?>
Output
1 2 3 4 5
Loops execute a block of code a specified number of times, or while a specified condition is true.
Syntax
for (initialize; condition; increment)
{
block of codes
}
Example
<?php
for($i=1;$i<=10;$i++){
echo $i.” t”;
}
?>
Output
1 2 3 4 5 6 7 8 9 10
Do While loop is similar to While loop But the difference is that its an exit control loop . That means the code in the loop will get executed at least once
Syntax
Do{
//Block of codes
}while (condition)
Example
<?php
$i=6;
do{
echo $i++.” t”;
}while($i<=5)
?>
Output
6
You can see that even though the condition is not true it will print the first value