PHP continue statement

PHP continue statement and break statement are identical but the only difference is PHP continue statement just skip the current iteration and continue execute other iteration inside loop. We can use continue statement in PHP iteration statement such as for loop, while loop and do-while loop. 

We can define PHP continue statement by using if statement such as if(condition) continue;  If the condition is true then the continue statement is executed.  Now we consider an example to understand the PHP continue statement.

PHP continue statement example:

<?php

for($count=0; $count<=10; $count++)

{

if($count==5)

continue;

echo $count;

}
In this example after if condition we use continue statement. So this program not print 5 because for continue statement. The output look like this where 5 is missing
1234678910

assignment operators in php



                            assignment operators in php     :      = , += , -= , *= , /= , .= , %=

<?php

$num1=10;
$num2=20;
echo ('<br>'. $num1." " .$num2);
?>


output :10 20




<?php
$num1=10;
$num2=20;
echo ('<br>'.$num2+=$num1);
?>


output :
30 





<?php


$num1=10;
$num2=20;
echo ('<br>'.$num2-=$num1
);?>


output :
10



<?php


$num1=10;
$num2=20;
echo ('<br>'.$num2*=$num1);
?>


output :
200





<?php


$num1=10;
$num2=20;


echo ('<br>'.$num2/=$num1);?>

output :
2



<?php
$num1=10;
$num2=20;
echo ('<br>'.$num2.=$num1);?>


output :
2010




<?php

$num1=10;
$num2=20;
echo ('<br>'.$num2%=$num1);

?>

output :
0








How to install propel on Ubuntu with pear

First install php-pear and php5-xsl, if you don't already have.

sudo apt-get install php5-xsl php-pear

Than you should install phing
sudo pear channel-discover pear.phing.info
sudo pear install phing/phing

Now you can install propel
sudo pear channel-discover pear.propelorm.org
sudo pear install -a propel/propel_generator
sudo pear install -a propel/propel_runtime

Also you can install Log
sudo pear install -a Log

Now you can use propel-gen in the console.
propel files at /usr/share/php/propel

Data Types in PHP

PHP supports eight primitive types.

Four scalar types:

boolean

integer

float (floating-point number, aka 'double')

string

Two compound types:

array

object

And finally two special types:

resource

NULL

This page also introduces some pseudo-types for readability reasons:

mixed

number

callback

And the pseudo-variable $....

You may also find some references to the type "double". Consider double the same as float, the two names exist only for historic reasons.

The type of a variable is usually not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which that variable is used.

Note: If you want to check out the type and value of a certain expression, use var_dump().

If you simply want a human-readable representation of the type for debugging, use gettype(). To check for a certain type, do not use gettype(), but use the is_type functions. Some examples:

$a_bool = TRUE; // a boolean

$a_str = "foo"; // a string

$a_str2 = 'foo'; // a string

$an_int = 12; // an integer

echo gettype($a_bool); // prints out: boolean

echo gettype($a_str); // prints out: string

// If this is an integer, increment it by four

if (is_int($an_int)) {

$an_int += 4;

}

// If $bool is a string, print it out

// (does not print out anything)

if (is_string($a_bool)) {

echo "String: $a_bool";

}

?>

If you would like to force a variable to be converted to a certain type, you may either cast the variable or use the settype() function on it.

Hire Php Web Developers Designers India

Hire Dedicated Php Web Developers Website Designers Programmers in India to design customized website application as per your business needs.

This Php Web Development Service Providers Web Developers and Website Designers and Prorammers are Available to Hire as Dedicated Staff.

Hire Php Website Developer from India

Hiring Php Web Developers any corporate company can easily develop their custom web application as per their complex business requirements.

Thanks & Regards

WeTheDevelopers - Php Web Development Company India

www.WeTheDevelopers.com

PHP Security

Now-a-days web security has been a major concern.During development, when the code is being written, it is important to consider illegitimate uses of your application. Often, the focus is on making the application work as intended, and while this is necessary to deliver a properly functioning application, it does nothing to help make the application secure. fact that you are here is evidence that you care about security,

Since PHP is a growing language being used for the web development,It's very important to discuss about PHP security.

Input flaws
most common PHP security flaws is the unvalidated input error. User-provided data simply cannot be trusted and should be validated properly.

register_globals = OFF. The register_globals directive is disabled by default in PHP versions 4.2.0 and greater.Enabling register_globals may cause a security risk.
A common example to explain the problem is as follows.
this example that illustrates how register_globals can be problematic is the following use of include with a dynamic path:


With register_globals enabled, this page can be requested with ?path=http%3A%2F%2Fevil.example.org%2F%3F in the query string in order to equate this example to the following:




Avoid using $_REQUEST[] since as per GPC rule $_GET has higher priorities than $_POST, So $_POST variables may be overwritten.

Always validate input data against maxlength in PHP.you can use array and for each to do this.
50);
foreach($max as $key=>$val)
{
if(strlen($_POST[$key])>$val)
{
//display maxlength error
}
}
?>



Assignment #5

File created:
1)item.php (time spent: 1hr 20 mins)
To view each single item within the database.

2)categories.php (time spent: 1hr 30 mins)
To view all the items, can be sorted according to different categories.

3)mysql_content.sql (time spent: 1/2 hr)
Define the DB schema.
Learnt: To design and use mysql schema and sort the Data by categories.