Skip to main content

Some basic concepts of PHP

Sometimes some basic thing in PHP confuses us a Lot e.g difference between double quotes and single quotes , difference between echo and print etc. Although when we use these on one another place then everything works fine but there is some basic difference between the working of those. so today we going to understand some such type of basic things in PHP.

Single Quotes and Double Quotes
    Single quotes will just put exactly what is inside it single quotes can never sense any variable in its scope but Double quotes will evaluate first what is given in it. e.g.

 $variable = 'some string';
  echo '$variable';     // Output will be $variable
 echo "$variable";     // Output will be Some string

But if we use it for a simple string then output will be same in both cases and also the biggest difference between both it their processing speed. Single quotes are much faster that double quotes. its quite difficult to see in small programs. if you got a 1500 times a loop then you can easily see the difference.

echo and print
     Echo and print both are use to output the information on user's screen but the difference is that print can return true or false means its useful if we want to use it in loop but echo is different it doesn't returns any value that's why it is faster than print otherwise the use of echo and print is save.

Use Nested Quotes
     if you want to use Quotes inside the quotes means double quotes inside double quotes then you have to 'escape' them eg
 
  echo "this is "an example"";



this is not gonna work because when it will show an error to use nested quotes you have to escape them with backslash (\). you can do that in following manner.

 
echo "this is \" an example \"";



the above given code will work fine. So these were some basic thing about PHP for beginners hope this  will help.
   

Comments

Popular posts from this blog

Network Topologies (Tutorial-4)

Topology refers to the way in which the network of computers is connected. The choice of topology is dependent upon--- Type and number of equipment being used  Planned applications and rate of data transfers  Required response times  Cost Types of Network Topologies Physical Topology: Physical topology defines how devices are connected to the network through the actual cables that transmit data(physical structure of the network)  Logical Topology: Logical Topology (also referred to as Signal Topology) is a network computing term used to describe the arrangement of devices on a network and how they communicate with one another.

Cisco Hierarchical Model

Cisco Hierarchical Model Defined by Cisco to simplify the design, implementation, and maintenance of responsive, scalable, reliable, and cost-effective networks. The 3 layers are logical and not physical – there may be many devices in a single layer, or a single device may perform the functions of 2 layers, eg: core and distribution. The Cisco Hierarchical Model

Eden: PHP Library To Get Things Easy For PHP Developer

Eden is PHP Library designed for helping developers in their rapid development work. In Our most of the project we have to integrate our developed website or application with most of  the social networking websites like Google, Facebook, Twitter, yahoo etc. so what we do is we integrate libraries of different websites differently Although We could make the code reusable but still if the websites increases then confusion will also increases. Adding different libraries form different sources add more complexity to your project and ends up to be hard to maintain. Eden simply a set of reusable components, that works with any PHP framework and CMS. Eden makes code logical and readable with dead simple syntax. Eden Will work With Most Of Web services including Amazon Web service Facebook Foursquare Google twitter tumbler Paypal Yahoo You could Download the File From  Eden Official Website  and Can use this will just a simply including this...