Studied PHP yesterday

Yesterday , Mr.Palaniappan sir asked to read some syntax in php

and asked to practice

These are some Basic concept of array and its syntax that I practiced yesterday :

Arrays :

Printing arrays

$names[0] = "sathia";
$names[1] = "suresh";
$names[2] = "yogesh";
$names[3] = "venky";
for($i=0;$i<4;$i++) {
 echo $names[$i]."<br />";

Seeing array or variable present or not

$ara = array("hi","hello","how","are","you");
$name = "sathia";
 echo "present<br />";
else {
 echo "Not Present<br />";

if(isset($name)) {
 echo "$name is there";

else {
 echo "Not there";

Converting Array to Variable

$person = array('name' => 'Fred', 'age' => 35, 'wife' => 'Betty');
echo $name;

Converting variables into array

$color = 'indigo';
$shape = 'curvy';
$floppy = 'none';
$b = compact('color', 'shape', 'floppy');
$names = array('color', 'shape', 'floppy');
$a = compact($names);
echo print_r($a);

Checking Password Field is empty ?

if(empty($_REQUEST['pass'])) {
echo "enter the password";
<form action = "empty.php" method = "POST">
Name :<input type = "text" name = "uname" />
Password :<input type = "text" name = "pass" />
<input type = "submit" value = "login">


About sathia

Web developer at cloudmint
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s