Tag Archives: Complete Execution

PHP Arithmetic Operator

Arithmetic operators

Arithmetic operators are used to perform elementary mathematical calculation and are used when value of variable declare in integer type.

Name Example Output
Addition $a+$b The sum of $a and $b
Subtraction $a-$b The difference between $a and $b
Multiplication $a*$b The product of $a and $b
Division $a/$b The quotient of $a and $b
Modules $a%$b The remainder after dividing $a and $b

Let us look at some examples for a better understanding of arithmetic operators:

Addition
$a = 3;
$b = 6;
$c = $a+$b ; // The value of $c is now 9.
Subtraction
$a = 11;
$b = 2;
$c = $a-$b; //The value of $c is now 9.
Multiplication
$a = 3;
$b = 3;
$c = $a*$b; //The value of $c is now 9.
Division
$a = 18;
$b = 2;
$c = $a/$b ; //The value of $c is 9.
Modules
$a = 9;
$b = 3;
$c = $a%$b; //The value of $c is now 0.

PHP Compound Data Type

PHP consist of two compound types, arrays and objects.

Arrays

Arrays are special types of variables that can store more than one value. Arrays are useful when you need to store related variables data under one variable name.

An array can be declare in fallowing way:

$arr-name [key]= value;

In the above statement
arr_name is the name of the array.
Key is any string or a non negative integer. if you want to modify an array, it is best not to specify a key and to leave the square bracket empty.
Value is the data that is held in the array.

To understand the concept arrays, consider the fallowing codes:

<?php
$arr_name[0]="My";
$arr_name[1]="name";
$arr_name[2]="is";
$arr_name[3]="Rishi";
echo "$arr_name[0] $arr_name[1] $arr_name[2] $arr_name[3] $arr_name[4]";
?>

Output of the above code is: My name is Rishi

Objects

Objects are are the building blocks of a programming language . An object is an entity that can hold data and specify what need to be done with the data. Most of the internal working of an object are hidden from the code that uses them. Objects are a bundle of variable and functions that are derived from a class. To understand the concept of object you should be familiar with the fallowing terminology

Object orientation

The programming concept that revolves around objects.An object is an instance of a class.

Class.

A class is an entity that exibit certain behavior and expose certain attributes to retain state.

Properties

The character of an object defined by the class to which it belongs.

Methods

Task that can be performed by object on the data they contain.

Juggling Data Types

PHP does not require the developer to absolutely specify a data type for a variable at the time ofdeclaration. In PHP you need not worry about data type mismatches in an expression. Consider the fallowing example:

<?php
 $myVal = 7+ "2 is my number";
 echo $myVal;
?>

The output will be: 9.

In most other language ,the preceding code will not be valid. In PHP this statement is valid, and it also generates the expected output. This is because in PHP a variable doesn’t have fixed data type assign to it and can store any data type. The result of an expression is calculated on the basic of the operator and not on the basic of the operands. Examine the fallowing code for a better understanding of juggling data type:

<?php
  $a = "Rishi";
  $a +=2; // The += operator is use to add the initial value assigned to
// the variable to the number specified.r>  echo?>

The output will be : 2

In the above example ,$a contains a value that is of the string data type. In the next line, the += operator changes the initial variable assigned to $a to 2.

Consider another example where the .= operator is used to concatenate string:

<?php
 $a = "Rishi";r>  $a .=2; //The .= operator is use to concatenate two string .
 echo $a; //The value of $a is now Rishi2 
?>

The output will be: Rishi2

The . = operator tells the PHP that the number 2 is a string even though it is not specified in single quotes or double quotes. As a result it concatenates the initial value with the new value of $a, and the output is Rishi2.

Constants

A constant is a name that identifies a simple value. By nature, a constant is the opposite of a variable because the value of a constant remains fixed and doesn’t change when the script is executed. Constant have the fallowing characteristics:
– A constant is case sensitive by default.
– By convention, constant are expressed in uppercase letters.
– A consent can begin with either an underscore or with a letter, fallowed by any number of underscore, letters or numbers.

There are several other differences between variable and constants:

– A constant name never begins with a dollar sign .
– After a constant is set, it is not possible to to redefine or undefined it.
– A constant can contain only scalar data type like : Boolean, integer, float and string.
– A constant can be accessed and use anywhere in a script regardless of variable scoping rules.

Defining constants

A simple way to define a constant by using the define ( ) function. After you define a constant, you can read it’s value anytime you want by simply using it’s name. To read a constant value you can use the constant ( ) function. To obtained a list of all defined coinstants, you can use the get-defined-constants function.
In the fallowing code, a constant ADMIN_MAIL is defined with the value “contatc@a2zwebhelp.com”. Notice that constants are case sensitive, and the value assigned to the constant ADMIN_MAIL doesn’t appear when you try to print the value of the constant admin_mail:

<?php
    define ("ADMIN_MAIL" ,"contatc@a2zwebhelp.com");
  echo MIN_MAIL;
?>

The output will be: contatc@a2zwebhelp.com

Media Width/ Device Width

Responsive Web Design Media Width Viewport Size

The Following table shows screen resolution for different devices. For more detail please visit wikipedia. It is always better to write your media query in your CSS file for the following resolutions. 320px, 480px, 600px, 800px, 960px, 1024px and 1280px+. Click here to know how to crate a css file for responsive web design.

Device Name With Resolution
Company Model Diagonal
cm/in
Resolution Viewport
Apple iPad – 1st Gen, 2 25 (9.7) 1024 x 768 768 x 1024
Apple iPad – 3rd Gen, 4th Gen 25 (9.7) 2048 x 1536 768 x 1024
Apple iPad Mini – 1st Gen 20 (7.9) 1024 x 768 768 x 1024
Apple iPhone 4 / iPod Touch 8.9 (3.5) 960 x 640 320 x 480
Apple iPhone 4S / iPod Touch 8.9 (3.5) 960 x 640 320 x 480
Apple iPhone 5 10 (4) 1136 x 640 320 x 568
Apple iMac 21.5-inch 55 (21.5) 1920 x 1080 1920 x 1080
Apple iMac 27-inch 69 (27) 2560 x 1440 2560 x 1440
Blackberry BlackBerry PlayBook 18 (7) 1024 x 600 600 x 1024
Blackberry BlackBerry Z10 11 (4.2) 1280 x 768 345 x 521
Nokia Lumia 710 9.4 (3.7) 800 x 480 320 x 480
Motorola Motorola Defy 9.4 (3.7) 854 × 480 320 x 569
Motorola Motorola Droid 9.4 (3.7) 480 x 854 360 x 599
Motorola Motorola Droid Razr 11 (4.3) 540 x 960 360 x 640
Motorola Motorola Razr HD 4G 12 (4.7) 720 x 1280 360 x 598
Motorola Motorola Milestone 9.4 (3.7) 480 x 854 320 x 569
Motorola Motorola Xoom 25.7 (10.1) 800 x 1280 800 x 1280
Nokia Lumia 800 9.4 (3.7) 800 x 480 320 x 480
Nokia Lumia 820 11 (4.3) 800 x 480 320 x 480
Nokia Lumia 900 11 (4.3) 800 x 480 320 x 480
Nokia Lumia 920 11 (4.5) 1280 x 768 320 x 480
Nokia Lumia 1020 11 (4.5) 1280 x 768  –
Samsung Galaxy W (I8150) 9.4 (3.7) 480 x 800  –
Samsung Galaxy S 10 (4.0) 480 x 800 320 x 534
Samsung Galaxy SII 10.8 (4.27) 480 x 800 320 x 533
Samsung Galaxy S III (I9300) 12 (4.8) 720 x 1280 360 x 640
Samsung Galaxy S4 (I9500) 13 (5) 1080 x 1920
Samsung Galaxy Nexus 11.8 (4.65) 720 x 1280 320 x 532
Samsung Galaxy Tab 18 (7) 600 x 1024 600 x 1024
Samsung Galaxy Tab 7.7 20 (7.7) 800 x 1280 800 x 1280
Samsung Galaxy Tab 10.1 26 (10.1) 800 x 1280 800 x 1280
Samsung Galaxy Note 13 (5.3) 800 x 1280 400 x 640
Samsung Galaxy Note II 14.1 (5.55) 720 x 1280 360 x 640
Samsung Galaxy Note 10.1 26 (10.1) 1280 x 800 800 x 1280
Sony Sony Vaio Z92 33 (13.1) 1600 x 900
Sony Sony Vaio Z128 33 (13.1) 1920 x 1080
Sony Sony Vaio F series 42 (16.4) 1920 x 1080
Sony Xperia S 11 (4.3) 720 x 1280 360 x 640
Sony Xperia Sola 9.4 (3.7) 480 x 854 320 x 569
Sony Xperia U 8.9 (3.5) 854 x 480 320 x 569
Sony Xperia Ion 11.6 (4.55) 720 x 1280
Sony Xperia Z 13 (5) 1920 x 1080 360 x 598
Sony Xperia E 8.9 (3.5) 320 x 480 320 x 480

Media Queries

How to create media queries in Responsive Web

We need to write our media query for the following resolutions in our css file.  320px,  480px,  600px,  800px,  960px, 1024px and 1280px+.  So @media will from 320px to 479px,  480px to 599px, 600px to 767px,  768px to 959px,  960px to 1023px, 1024px to 1279px and lastly the default css which display 1280px and higher resolutions.  If your design layout is below 1024px the you need not to write mediaquery for 1024px to 1279px.

For the above criteria the css file should be like this

/*
 Your default css code goes here..
*/

@media (min-width: 960px) and (max-width: 1023px) { 
  /* CSS for browsers less than 1024px*/
}

@media (min-width: 768px) and (max-width: 959px) { 
  /* CSS for browsers less than 960px*/
}
@media (min-width: 600px) and (max-width: 767px) { 
  /* CSS for browsers less than 768px*/
}

@media (min-width: 480px) and (max-width: 599px) { 
  /* CSS for browsers less than 600px*/
}

@media (min-width: 321px) and (max-width: 479px) { 
  /* CSS for browsers less than 480px*/
}

@media (max-width: 320px) { 
 /* CSS For 320px or less browsers */
}

Though there is no standing rule for device width, you can use media width for any screen resolution. The above is just a sample to show how to define @media and write css code.

Click here to view list of devise and screen resolution in pixel.

Enterprise Resource Planning

“Optimize the company’s business processes by IWCn ERPs”

OBJECTIVES

IWCn offers ERP modules implementation for companies that look for strengthening their competitive edge with smart technology and business process engineering.To address your business needs IWCn offers scalable and cost-effective solutions approach and relevant industry/domain experience.

Continue reading