> August 2012 ~ Online tutorial

Arithmetic Operators in php

Using Arithmetic Operators
To perform mathematical operations on variables, use the standard arithmetic
operators, as illustrated in the following example:

<?php

// define variables

$num1 = 101;

$num2 = 5;

// add

$sum = $num1 + $num2;

// subtract

$diff = $num1 - $num2;

// multiply

$product = $num1 * $num2;
// divide

$quotient = $num1 / $num2;

// modulus

$remainder = $num1 % $num2;

?>



To perform an arithmetic operation simultaneously with an assignment, use the

two operators together. The following two code snippets are equivalent:


<?php

$a = $a + 10;

?>

<?php

$a += 10;

?>


Operator What It Does
= Assignment
+ Addition
- Subtraction
* Multiplication
/ Division; returns quotient
% Division; returns modulus
&& Logical AND
|| Logical OR
xor Logical XOR
! Logical NOT
++ Addition by 1

Data types in PHP


Understanding Simple Data Types


Every language has different types of variables—and PHP has no shortage of choices.
The language supports a wide variety of data types, including simple numeric,
character, string, and Boolean types, and more complex arrays and objects.

Data Type Description Example
Integer An integer is a plain-vanilla

number like 75, -95, 2000,

or 1.
$age = 99;
Boolean The simplest variable type

in PHP, a Boolean variable

simply specifies a true or

false value
$auth = true;
Floating-point A floating-point number

is typically a fractional

number such as 12.5

or 3.149391239129.

Floating point numbers may

be specified using either

decimal or scientific notation.
$temperature = 56.89;
String A string is a sequence of

characters, like 'hello' or

'abracadabra'. String

values may be enclosed in

either double quotes ("") or

single quotes ('').
$name = 'Harry';
In many languages, it’s essential to specify the variable type before using it; for

example, a variable may need to be specified as type integer or type array.

Give PHP credit for a little intelligence, though—the language can automagically

determine variable type by the context in which it is being used.

Writing Statements and Comments in php


Writing Statements and Comments


As you can see from the previous example, a PHP script consists of one or more
statements, with each statement ending in a semicolon. Blank lines within the
script are ignored by the parser. Everything outside the tags is also ignored by the
parser, and returned as is; only the code between the tags is read and executed.

TIPS

If you’re in a hurry, you can omit the semicolon on the last line of a PHP
block, because the closing ?> includes an implicit semicolon. Therefore,
the line is<?php echo 'Hello' ?>  perfectly valid PHP code.
This is the only time a PHP statement not ending in a semicolon is still
considered valid.
For greater readability, you should add comments to your PHP code, as I did in
the previous example. To do this, simply use one of the Comments styles listed here:


<?php


// this is a single-line comment

# so is this

/* and this is a

multiline

comment */

?>

Feature in PHP

Features

As a programming language for the Web, PHP is hard to ignore. Clean syntax,
object-oriented fundamentals, an extensible architecture that encourages innovation,
support for both current and upcoming technologies and protocols, and excellent
database integration are just some of the reasons for the popularity it currently
enjoys in the developer community.

Simplicity:

                 Because PHP uses a consistent and logical syntax, and because it comes with
a clearly written manual, even novices find it easy to learn. In fact, the quickest
way to learn PHP is to step through the manual’s introductory tutorial, and then
start looking at code samples off the Web. Within a few hours, you’ll have learned
the basics and will be confident enough to begin writing your own scripts. This
adherence to the KISS (Keep It Simple, Stupid) principle has made PHP popular
as a prototyping and rapid application development tool for web applications. PHP
can even access C libraries and take advantage of program code written for this
language, and the language is renowned for the tremendous flexibility it allows
programmers in accomplishing specific tasks.

Portability:

With programming languages, portability—the ease with which a program can
be made to work on different platforms—is an important factor. PHP users have
little to fear here, because cross-platform development has been an important
design goal of PHP since PHP 3.0. Today, PHP is available for a wide variety of
platforms, including UNIX, Microsoft Windows, Mac OS, and OS/2. Additionally,
because PHP code is interpreted and not compiled, PHP scripts written on one
platform usually work as is on any other platform for which an interpreter exists.
This means that developers can code on Windows and deploy on UNIX without
any major difficulties.

Speed:

          Out of the box, PHP scripts run faster than most other scripting languages, with
numerous independent benchmarks putting the language ahead of competing
alternatives like JSP, ASP.NET, and Perl. When PHP 4.0 was first released, it
raised the performance bar with its completely new parsing engine. PHP 5.0
improves performance even further through the use of an optimized memory
manager, and the use of object handles that reduce memory consumption and
help applications run faster.


Open Source:

         Possibly the best thing about PHP is that it’s free—its source code is freely
available on the Web, and developers can install and use it without paying licensing
fees or investing in expensive hardware or software. Using PHP can thus significantly
reduce the development costs of a software application, without compromising on
either reliability or performance. The open-source approach also ensures faster bug
fixes and quicker integration of new technologies into the core language, simply
due to the much larger base of involved developers.

Extensible:

Keeping future growth in mind, PHP’s creators built an extensible architecture
that enables developers to easily add support for new technologies to the language
through modular extensions. This extensibility keeps PHP fresh and always at
the cutting edge of new technology. To illustrate this, consider what PHP lets you
do through its add-on modules: dynamically create image, PDF, and SWF files;
connect to IMAP and POP3 servers; interface with MySQL, Oracle, PostgreSQL

,and SQLite databases; handle electronic payments; parse XML documents; and
execute Perl, Java, and COM code through a PHP script. And as if all that wasn’t
enough, there’s also an online repository of free PHP classes called PEAR, the
PHP Extension and Application Repository, which provides a source of reusable,
bug-free PHP components.


BUY IT:

Title Tag Optimization

1)Indicate page titles by using title tags

A title tag tells both users and search engines what the topic of a particular page is. The <title> tag should be placed within the <head> tag of the HTML document


(1). Ideally, you should create a unique title for each page on your site.

<html>
<head>
<title>Brandon's Baseball Cards - Buy Cards, Baseball News, Card Prices</title>
<meta name="description=" content="Brandon's Baseball Cards provides a
large selection of vintage and modern baseball cards for sale. We also offer
daily baseball news and events in">
</head>
<body>

1) The title of the homepage for our baseball card site, which lists the business
name and three main focus areas.


2)Page title contents are displayed in search results

If your document appears in a search results page, the contents of the title tag will usually appear in the first line of the results (if you're unfamiliar with the different parts of a Google search result, you might want to check out the anatomy of a search result video by Google engineer Matt Cutts, and this helpful diagram of a Google search results page). Words in the title are bolded if they appear in the user's search query.This can help users recognize if the page is likely to be relevant to their search

3)The title for your homepage can list the name of your website/business and could include other bits of important information like the physical location of the business or maybe a few of its main focuses or offerings .

3)Be mindful of length

70 characters is the maximum amount that will display in the search
title tag has been cut off), and sticking to this limit is generally wise.
keyword phrase) and having them in the title tag is essential to
ranking, it may be advisable to go longer.



4)Place important keywords close to the front
5)Leverage branding



Using keywords in the title tag means that search engines will bold these search terms this  has performed a query with those terms. This helps garner a
greater visibility and a higher click-through rate.

6)Consider readability and emotional impact
The closer to the start of the title tag your keywords are, the more
testing and experience.
At SEOmoz, we love to start every title tag with a brand name
mention, as these help to increase brand awareness, and create a
higher click-through rate for people who like and are familiar with a
brand. Many SEO firms recommend using the brand name at the end
of a title tag instead, and there are times when this can be a better
site) and how strong the brand is.

Creating a compelling title tag will pull in more visits from the search
important to not only think about optimization and keyword usage,
interaction with your brand and should convey the most positive
impression possible.

SEO Tutorial for beginner

seo interview questions

1 ) What is Search Engines ?


 Search Engine are Key of Finding Specific Information on the vast expanse of the World Wide Web

2 ) How to achieve Google Page Rank ? 

 Google Page Rank Largely Dependent on Links so more the Backlinks you have the more is your page rank it also affected by the rank of page linked to you.
One other thing that you should consider is that the older your website is, the more trusted and favorable it is to Google. A website with plenty of pages, a lot of incoming links, and also plenty of internal links to other pages within your website–all these are well regarded by Google.

3 ) What are Meta Tags .

They are keywords that are Hidden in the Code of your Page. Search Engine can see and Viewed them but generally your visitor can’t.

4 ) What is Value of Title Tags used in Website ?

Title is Vital to your SEO Efforts. Each Page need to have a Unique Title that accurately describe the content containing in that pages.
Reason : Page title is important because this is what will be displayed in the result section of search

 5 ) What is Site Map ?

 Search Engines need a Site Map to Index your site properly. This will them what content you have and How you organized that content. By using site map you make your site more search engine friendly and increasing the chance of frequent indexing.

6 ) Why we use Robots.txt File ?

Robots file is used when you have duplicate content that you don’t want to be indexed, or you want to create a no follow rule for specific areas of your Websites, you need one of these files

7 ) How Keywords are Choose for Optimization ?

The Success of Choosing Keywords is to pick the Keywords that are Popular, related to your content and effective. Avoid the practice of overusing or over stuffing your keywords. Stick to density of 3-4% per page on your top keywords for the best effect.

8 ) What is Black Hat SEO ?

 Race Among websites to attain High Ranking has brought about a Number of methods and technique used to achieve this goals. These Methods can be characterized into two Groups depend on there acceptability to search engines.

White Hat SEO – SEO Methods that conform to search engine Guidelines are White Hat

Black Hat SEO – SEO Methods those are viewed as less acceptable are called Black Hat

9 ) What is Cloaking ?

Cloaking involves having two separated pages one to show to google bot and other to show to your sites visitors

10 ) What is Blog Flipping ?

Practice of selling Blog to other one after it attains popularity and traffic.

11) What is PPC 

PPC method of Online Advertisement where you pay per click when visitor type your ad displayed on search engine

12)What is bounce Rate?

Bounce Rate is the percentage of single-page visits from user.







What is SEO

What SEO Is

Search Engine Optimization refers to the collection of techniques and practices that allow a site to get more traffic from search engines (Google, Yahoo, Microsoft). SEO can be divided into two main areas: off-page SEO (work that takes place separate from the website) and on-page SEO (website changes to make your website rank better). This tutorial will cover both areas in detail! Remember, a website is not fully optimized for search engines unless it employs both on and off-page SEO.

What SEO Is Not

SEO is not purchasing the number #1 sponsored link through Google Adwords and proclaiming that you have a #1 ranking on Google. Purchasing paid placements on search engines is a type of Search Engine Marketing (SEM), and is not covered in this tutorial.
SEO is not ranking #1 for your company's name. If you're reading this tutorial, you probably already know that ranking for popular terms is darn near impossible, but specific terms, such as a company name, is a freebie. The search engines usually are smart enough to award you that rank by default (unless you are being penalized).

Who Uses SEO

If a website is currently ranked #10 on Google for the search phrase, "how to make egg rolls," but wants to rise to #1, this websites needs to consider SEO. Because search engines have become more and more popular on the web, nearly anyone trying to get seen on the web can benefit from a little SEO loving.

Keyword Research

Before you can start optimizing your site for the search engines, you must first know which terms you want to target. A good start would be to choose 3 or 4 keywords you would like your website to rank well for. With these keywords in your mind you can then set a goal to rank in the top 10 results on Google for each of them (we refer to Google because if you can rank well there, you'll rank well on the other search engines). These keywords can be either broad or specific, but you'll want to study our list of pros and cons of each before choosing.



Broad Keywords
A broad keyword is one that many people search for, because they may only have a vague idea of what they're looking for. Broad keywords tend to be very short and aren't very specific (e.g. "shoes" or "sports"). These keywords are difficult to rank #1 for because so many other websites might have an article or two that mention shoes. However, if you can rank well for a broad keyword, you will be receiving a great deal of traffic.

Summary:

Hard to rank for, but worth it in the long run. We recommend that beginners only choose a broad keyword if their industries are not very competitive.

Specific Keywords
A specific keyword is something that contains many adjectives or words that make the search very targeted. The people doing these types of searches know exactly what they want (e.g. "used black high heel shoes"). These keywords are much less competitive and are easier to rank for on search engines. The downside is that they receive a great deal less volume of searches per month. In terms of traffic, you will need to have several #1 rankings for specific keywords to equal one #1 ranking broad keyword.
Summary: Easier to rank for and it's highly targeted traffic. The only downside is that the number of visitors you will receive is relatively low.

Unique or Branded Keywords

These are the words that are specific to only your company. They are one of the most easiest ways to get traffic. However, some companies will release a new product, with a unique name, and then forget to optimize for that keyword on their website. Their SEO savvy competitors can then pick up the slack and take over the top rankings for these terms. If you have a popular brand or product, make sure that you have optimized for these freebie keywords.

Keyword Research Tools

Keyword research tools are 2 parts voodoo magic and 1 part hard statistic. This is partly due to Google not releasing actual numbers and partly due to overeager SEO Tool developers trying to sell their products. Because there is such a sizable uncertainty in all keyword research tools, it is best to use as many different sources as you can,. Even with multiple sources, you should only take the information you gather as a recommendation, rather than a fact.

Yahoo has been releasing their keyword search information for years, and many tools are based off of this specific data. We've collected a wide variety of helpful tools that will give you a general idea of which keywords you should target when making and optimizing your websites.
Picking a Short List

To put the optimizing tactics that we teach to good use, we recommend that you try to target no more than 2 or 3 keyword phrases per page. A common mistake by many SEO beginners is to stuff 500 different keywords on one page and wait for the #1 rankings to roll in. That might have worked 10 years ago, but the algorithms that search engines use these days are much more sophisticated and are not tricked by this. That's why it's best to start small, and be concise with the keywords that you choose. New sites in particular will find it nearly impossible to rank well for many keyword phrases upon first starting out.