Latest Version of Ionic Provides Universal Design System for Enterprises

Ionic Framework 4.0, rebuilt using open web standards, brings universal compatibility across platforms, devices, and developer frameworks—helping enterprises deliver consistent brand experiences at scale

MADISON, Wis., Jan. 23, 2019 GLOBE NEWSWIRE — Ionic, the most widely used platform for building mobile and desktop apps using web technology, has launched version 4.0 of the open source Ionic Framework. The highly-anticipated release provides a complete cross-platform UI library built on Web Components, compatible with any front-end framework. Through the use of open web standards, Ionic 4.0 helps enterprises address the growing need to adopt design systems: A centralized library of components that can be shared across teams and projects to simplify design and development while ensuring consistent brand experiences, at scale.

More than five million developers worldwide use Ionic Framework to tackle development of consumer-facing and internal enterprise applications—using one shared codebase across platforms. This level of efficiency is especially critical for companies today given the increasing demand from consumers to build connected digital experiences. Previous versions of Ionic Framework were based on Angular components and only worked with the Angular front-end framework. With the 4.0 release, Ionic has rebuilt its entire UI library using Web Components, a set of standardized APIs that make it possible to build fast, feature-rich apps that are natively supported in any modern browser on all major platforms, and are compatible with any front-end framework.

Ionic 4.0’s foundation in Web Components makes it possible for developers to build for any platform or device, no matter the tooling or front-end technologies involved. The benefits of this for individuals and enterprises, alike, include:

  1. A customizable component library that works across teams and projects: Of all cross-platform approaches, only Ionic 4.0 provides UI components that are truly customizable, reusable, and shareable across all types of applications, including iOS, Android, Desktop (Electron), and the Web (Progressive Web Apps, etc.).
  2. Faster load times and smaller sizes: The shift to Web Components means that apps built with Ionic will load significantly faster and work better in low-bandwidth environments. On top of that, the 4.0 version adds smart defaults to improve load times. Put together, these improvements have helped Ionic achieve a 100/100 in Google’s Lighthouse score for application speed and performance.
  3. Technical agility to close the talent gap: Due to the flexibility of open web standards, Ionic now give developers and teams the freedom to build with the current and emerging tools they love, including Angular, React, and Vue; thus insulating enterprises from “framework churn” and making it easier to hire and retain developer talent.

“When we look at what’s happening in the world of front-end development, we see two major industry shifts,” said Max Lynch, co-founder and CEO of Ionic. “First, there’s a recognition that the proliferation of proprietary components has slowed down development and created design inconsistencies that hurt users and brands alike. More and more enterprises are recognizing the need to adopt a design system: a single design spec, or library of reusable components, that can be shared across a team or company. Second, with the constantly evolving development ecosystem, we recognized the need to make Ionic compatible with whatever framework developers wanted to use—now and in the future. Rebuilding our Framework on Web Components was a way to address both of these challenges and future-proof our technology in a truly unique way.”

Along with the Framework, Ionic offers a powerful set of tools and services to help enterprise teams address the need for digital experiences, from Studio, its localized development environment, to Appflow, a mobile DevOps solution, and Enterprise Engine, a fully-supported version of the Ionic development ecosystem.

Ionic Framework 4.0 is now available to use with Google’s Angular web application framework, including support for Angular tooling, such as the Angular CLI and Router. Versions of Ionic with Vue and React are currently in alpha.

About Ionic

Ionic is an open source UI toolkit and developer platform that makes it simple to build, test, and deploy stunning, high-performance apps for any platform or device—all using a single codebase. Since its inception in 2013, Ionic Framework has become the #1 adopted cross-platform hybrid development framework in the world, serving a vibrant community of more than 5 million developers in over 200 countries. Ionic’s open source Framework is best known for its developer-friendly tools and services, which have helped build and power notable cross-platform apps for consumer brands like Sworkit, Shipt, and MarketWatch as well as mission-critical apps for companies like NASA and Nationwide. For more information about Ionic and its suite of tools, visit ionicframework.com.

How to Install the Ionic

Install Ionic

npm install -g ionic

First, install Node.js. Then, install the latest Ionic command-line tools in your terminal. Follow the Android and iOS platform guides to install required tools for development.

Start an app

ionic start myApp tabs

Create an Ionic App using one of our ready-made app templates, or a blank one to start fresh. Check out the Market for more designs.

For v1 projects, use the --type ionic1 flag.
  1. $ ionic start myApp blank
  2. $ ionic start myApp tabs
  3. $ ionic start myApp sidemenu

Run your app

cd myApp ionic serve

Much of your app can be built right in the browser with ionic serve. We recommend starting with this workflow.

When you're ready to deploy your app to a real device, check out our Deploying guide.

what is amazon elastic compute cloud

What Is Amazon EC2?

Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) cloud. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster. You can use Amazon EC2 to launch as many or as few virtual servers as you need, configure security and networking, and manage storage. Amazon EC2 enables you to scale up or down to handle changes in requirements or spikes in popularity, reducing your need to forecast traffic.

Features of Amazon EC2

Amazon EC2 provides the following features:

  • Virtual computing environments, known as instances
  • Preconfigured templates for your instances, known as Amazon Machine Images (AMIs), that package the bits you need for your server (including the operating system and additional software)
  • Various configurations of CPU, memory, storage, and networking capacity for your instances, known as instance types
  • Secure login information for your instances using key pairs (AWS stores the public key, and you store the private key in a secure place)
  • Storage volumes for temporary data that’s deleted when you stop or terminate your instance, known as instance store volumes
  • Persistent storage volumes for your data using Amazon Elastic Block Store (Amazon EBS), known as Amazon EBS volumes
  • Multiple physical locations for your resources, such as instances and Amazon EBS volumes, known as Regions and Availability Zones
  • A firewall that enables you to specify the protocols, ports, and source IP ranges that can reach your instances using security groups
  • Static IPv4 addresses for dynamic cloud computing, known as Elastic IP addresses
  • Metadata, known as tags, that you can create and assign to your Amazon EC2 resources
  • Virtual networks you can create that are logically isolated from the rest of the AWS cloud, and that you can optionally connect to your own network, known as virtual private clouds(VPCs)

7 Popular Java Frameworks for 2019

List of 7 Popular Java Frameworks for 2019

Although the list begins with the most popular one but is not an indicator of the best fit for your project. So, let’s begin without further ado.

1. Spring Framework

Any Java developer would vouch for its capability to create complex, high-performance web applications.

With simple components and configurations, this modular framework enables you to develop enterprise-level Java applications with much ease. Its DI-dependency injection feature and compatibility with other frameworks such as Kotlin and Groovy make it Java developers’ favorite.

Spring Framework utilizes inversion of control (IoC) design principle and so for developers, it is easier to focus a module on the task and free the modules from the assumptions and make programs extensible.

It has a number of modules to achieve different functionality in an application such as Spring core (Base module), Spring AOP (for cross-context logic), Spring Transaction (For transaction support), Spring MVC (Web aspect), and more.Used For

  • Enterprise Java (JEE)
  • Web application development
  • Distributed application
  • Core features can be used for creating any Java applications
  • All layer implementations of a real-time application

Advantages

  • All-inclusive programming and configuration model
  • Support traditional database RDBMS as well as new NoSQL
  • Provide backward compatibility and testability of code
  • Loose coupling can be achieved using IoC
  • Supports Aspect Oriented Programming and enables cohesive development
  • JBDC abstraction layer for exceptional hierarchy

Limitations

  • Steep learning curve, most developers struggle with IoC and Dependency Injection
  • Configurations keep on changing so developers have to keep themselves updated with the latest change.
  • Although Dependency Injection is one of its strengths, it makes the project dependent on Spring framework

2. Grails

Grails is a dynamic framework, anchored by the Groovy JVM programming language. It works with Java technologies, including Java EE containers, Spring, SiteMesh, Quartz, and Hibernate.

This open source web development framework is widely popular among Java developers for Enterprise Java Beans or EJB support. Because of this, it does not need to configure the XML and so developers can quickly start the development process of creating a robust and scalable application.Used for Building

  • Content management systems
  • e-Commerce sites
  • RESTful web services

Advantages

  • Easy to use object mapping library
  • Simple GORM
  • A controller layer built on Spring Boot
  • Flexible profiles
  • Embedded Tomcat container for on the fly reloading
  • Advanced plugin system featuring hundreds of plugins
  • A responsive and supportive communit

Limitations

  • Runtime language and so error-prone
  • Not the best choice for multi-threaded app
  • Need to purchase IntelliJ Idea, do not support any other IDE
  • Must learn Groovy language
  • Complex integration process

3. Blade

This 2015 born framework is so simple and lightweight that any developer from project’s perspective can understand it in a single day.

Based on Java 8, Blade, a lightweight MVC Framework provides a RESTful-style routing interface, making the web API cleaner and much easier to understand and synchronizing data with the website.Used For

  • Full-stack web framework for creating web applications rapidly

Advantages

  • Simple, small (smaller than 500KB) and clear coding structure
  • Multiple components to choose from
  • Multiple configuration files support
  • CSRF (Cross-Site Request Forgery) and XSS (Cross-site scripting) defense support
  • Support plug-in extensions and webjar resources
  • Embedded jetty server and template engine support

Limitations

  • Complex dependency engine
  • Lack mobile-app richness
  • Heavy documentation

4. Google Web Toolkit

GWT is a completely free, open-source framework that enables the developers to write client-side Java code and deploy it as JavaScript. Many Google products have been written using GWT such as AdSense, AdWords, Google Wallet, and Blogger.

Using this framework, developers can easily write complex browser applications rapidly. GWT allows developers to develop and debug Ajax applications in the Java language.

During deployment, its cross-compilers translate the Java Applications to standalone JavaScript files. It comes with many features such as cross-browser portability, internationalization, bookmarking, and history and management.Used For

  • Building progressive web apps
  • Creating and maintaining complex JavaScript front-end applications

Advantages

  • Supports reusable approach for common web development tasks
  • Support for full-featured Java debugging
  • Developer-friendly RPC mechanism
  • HTML Canvas support provided
  • Google APIs can be used in GWT applications
  • Developers can design applications in a pure object-oriented manner

Limitations

  • Java to JavaScript compilation is slow
  • Proprietary methods for defining the structure
  • Need to write more code even for simple things
  • Best suitable only for Java developers

5. JavaServer Faces (JSF)

JavaServer Faces makes web application development much easier leveraging on existing, standard UI and web-tier concepts. Developed by Oracle, it has a set of APIs for representing and managing UI components and custom tag library for expressing a JSF interface.

JSF is based on MVC software design pattern and has an architecture that clearly defines a distinction between application logic and representation.Used For

  • Building native applications
  • Web applications
  • Enterprise applications

Advantages

  • Create custom tags to a particular client device
  • Connect the presentation layer to the application code easily
  • Build user interfaces of reusable components
  • Use XML instead of Java for view handling

Limitations

  • Incompatibility with standard Java technologies
  • Complex to perform simple tasks
  • Lack of flexibility
  • Minimum Ajax support
  • Steep learning curve

6. Play

Its popularity can be estimated by the fact that it is widely used by top companies such as Samsung, LinkedIn, Verizon, The Guardian, and more. Since it uses an asynchronous model that allows statelessness principle, play framework offers speed, performance, and scalability.

Built upon Akka Toolkit, Play framework abridge the creation of concurrent and distributed applications on the Java Virtual Machine. Its user interface is simple and intuitive and so developers can easily understand its basic features to begin the development project quickly.Used For

  • Web applications that demand consistent content creation
  • Building Java and Scala applications for desktop and mobile interfaces

Advantages

  • Hot reload for all Java code, configurations, and templates
  • Supports non-blocking I/O which is crucial for high-performance apps
  • Open source with a large community to contribute
  • Commercial support is also available
  • Compile and runtime error can be handled well

Limitations

  • Steep learning curve, extensive documentation
  • Acts volatile sometimes

7. Struts

Here’s another enterprise-level framework maintained by Apache Software Foundation. This full-featured Java Web Application Framework allows the developers to create easy-to-maintain enterprise-level Java application.

One of the most noted features of Struts is its plugins which are basically JAR packages. Means they are portable and can be added in the classpath of the app.

For object-relational mapping, you can use the Hibernate plugin and for dependency injection, you can rely on the Spring plugin.Used For

  • Enterprise application development

Advantages

  • Well-organized JSP, Java, and Action classes that reduce development time
  • Centralized configuration, as most of the Struts values are represented in property files or XML
  • Custom JSP tags available to output the properties of JavaBeans components
  • In-built capabilities for checking form values

Limitations

  • Single ActionServlet available, which causes scalability issues
  • Lack of backward flow
  • Less transparent
  • Non-XML compliance of JSP syntax

Conclusion

When it comes to Java frameworks, keep an open mind and research which one is best for you. There are so many frameworks that will suit your project but pick the one that requires less code to write your application and is easy to manage.

Object Oriented Programming | CPP | JAVA | C# | PHP

We can imagine our universe made of different objects like sun, earth, moon etc. Similarly we can imagine our car made of different objects like wheel, steering, gear etc. Same way there is object oriented programming concepts which assume everything as an object and implement a software using different objects.

Object Oriented Concepts

Before we go in detail, lets define important terms related to Object Oriented Programming.

  • Class − This is a programmer-defined data type, which includes local functions as well as local data. You can think of a class as a template for making many instances of the same kind (or class) of object.
  • Object − An individual instance of the data structure defined by a class. You define a class once and then make many objects that belong to it. Objects are also known as instance.
  • Member Variable − These are the variables defined inside a class. This data will be invisible to the outside of the class and can be accessed via member functions. These variables are called attribute of the object once an object is created.
  • Member function − These are the function defined inside a class and are used to access object data.
  • Inheritance − When a class is defined by inheriting existing function of a parent class then it is called inheritance. Here child class will inherit all or few member functions and variables of a parent class.
  • Parent class − A class that is inherited from by another class. This is also called a base class or super class.
  • Child Class − A class that inherits from another class. This is also called a subclass or derived class.
  • Polymorphism − This is an object oriented concept where same function can be used for different purposes. For example function name will remain same but it take different number of arguments and can do different task.
  • Overloading − a type of polymorphism in which some or all of operators have different implementations depending on the types of their arguments. Similarly functions can also be overloaded with different implementation.
  • Data Abstraction − Any representation of data in which the implementation details are hidden (abstracted).
  • Encapsulation − refers to a concept where we encapsulate all the data and member functions together to form an object.
  • Constructor − refers to a special type of function which will be called automatically whenever there is an object formation from a class.
  • Destructor − refers to a special type of function which will be called automatically whenever an object is deleted or goes out of scope.

Defining PHP Classes

The general form for defining a new class in PHP is as follows −

<?php
   class phpClass {
      var $var1;
      var $var2 = "constant string";
      
      function myfunc ($arg1, $arg2) {
         [..]
      }
      [..]
   }
?>

Here is the description of each line −

  • The special form class, followed by the name of the class that you want to define.
  • A set of braces enclosing any number of variable declarations and function definitions.
  • Variable declarations start with the special form var, which is followed by a conventional $ variable name; they may also have an initial assignment to a constant value.
  • Function definitions look much like standalone PHP functions but are local to the class and will be used to set and access object data.

Example

Here is an example which defines a class of Books type −

<?php
   class Books {
      /* Member variables */
      var $price;
      var $title;
      
      /* Member functions */
      function setPrice($par){
         $this->price = $par;
      }
      
      function getPrice(){
         echo $this->price ."<br/>";
      }
      
      function setTitle($par){
         $this->title = $par;
      }
      
      function getTitle(){
         echo $this->title ." <br/>";
      }
   }
?>

The variable $this is a special variable and it refers to the same object ie. itself.

Creating Objects in PHP

Once you defined your class, then you can create as many objects as you like of that class type. Following is an example of how to create object using newoperator.

$physics = new Books;
$maths = new Books;
$chemistry = new Books;

Here we have created three objects and these objects are independent of each other and they will have their existence separately. Next we will see how to access member function and process member variables.

Calling Member Functions

After creating your objects, you will be able to call member functions related to that object. One member function will be able to process member variable of related object only.

Following example shows how to set title and prices for the three books by calling member functions.

$physics->setTitle( "Physics for High School" );
$chemistry->setTitle( "Advanced Chemistry" );
$maths->setTitle( "Algebra" );

$physics->setPrice( 10 );
$chemistry->setPrice( 15 );
$maths->setPrice( 7 );

Now you call another member functions to get the values set by in above example −

$physics->getTitle();
$chemistry->getTitle();
$maths->getTitle();
$physics->getPrice();
$chemistry->getPrice();
$maths->getPrice();

This will produce the following result −

Physics for High School
Advanced Chemistry
Algebra
10
15
7

Constructor Functions

Constructor Functions are special type of functions which are called automatically whenever an object is created. So we take full advantage of this behaviour, by initializing many things through constructor functions.

PHP provides a special function called __construct() to define a constructor. You can pass as many as arguments you like into the constructor function.

Following example will create one constructor for Books class and it will initialize price and title for the book at the time of object creation.

function __construct( $par1, $par2 ) {
   $this->title = $par1;
   $this->price = $par2;
}

Now we don’t need to call set function separately to set price and title. We can initialize these two member variables at the time of object creation only. Check following example below −

$physics = new Books( "Physics for High School", 10 );
$maths = new Books ( "Advanced Chemistry", 15 );
$chemistry = new Books ("Algebra", 7 );

/* Get those set values */
$physics->getTitle();
$chemistry->getTitle();
$maths->getTitle();

$physics->getPrice();
$chemistry->getPrice();
$maths->getPrice();

This will produce the following result −

  Physics for High School
  Advanced Chemistry
  Algebra
  10
  15
  7

Destructor

Like a constructor function you can define a destructor function using function __destruct(). You can release all the resources with-in a destructor.

Inheritance

PHP class definitions can optionally inherit from a parent class definition by using the extends clause. The syntax is as follows −

class Child extends Parent {
   <definition body>
}

The effect of inheritance is that the child class (or subclass or derived class) has the following characteristics −

  • Automatically has all the member variable declarations of the parent class.
  • Automatically has all the same member functions as the parent, which (by default) will work the same way as those functions do in the parent.

Following example inherit Books class and adds more functionality based on the requirement.

class Novel extends Books {
   var $publisher;
   
   function setPublisher($par){
      $this->publisher = $par;
   }
   
   function getPublisher(){
      echo $this->publisher. "<br />";
   }
}

Now apart from inherited functions, class Novel keeps two additional member functions.

Function Overriding

Function definitions in child classes override definitions with the same name in parent classes. In a child class, we can modify the definition of a function inherited from parent class.

In the following example getPrice and getTitle functions are overridden to return some values.

function getPrice() {
   echo $this->price . "<br/>";
   return $this->price;
}
   
function getTitle(){
   echo $this->title . "<br/>";
   return $this->title;
}

Public Members

Unless you specify otherwise, properties and methods of a class are public. That is to say, they may be accessed in three possible situations −

  • From outside the class in which it is declared
  • From within the class in which it is declared
  • From within another class that implements the class in which it is declared

Till now we have seen all members as public members. If you wish to limit the accessibility of the members of a class then you define class members as private or protected.

Private members

By designating a member private, you limit its accessibility to the class in which it is declared. The private member cannot be referred to from classes that inherit the class in which it is declared and cannot be accessed from outside the class.

A class member can be made private by using private keyword infront of the member.

class MyClass {
   private $car = "skoda";
   $driver = "SRK";
   
   function __construct($par) {
      // Statements here run every time
      // an instance of the class
      // is created.
   }
   
   function myPublicFunction() {
      return("I'm visible!");
   }
   
   private function myPrivateFunction() {
      return("I'm  not visible outside!");
   }
}

When MyClass class is inherited by another class using extends, myPublicFunction() will be visible, as will $driver. The extending class will not have any awareness of or access to myPrivateFunction and $car, because they are declared private.

Protected members

A protected property or method is accessible in the class in which it is declared, as well as in classes that extend that class. Protected members are not available outside of those two kinds of classes. A class member can be made protected by using protected keyword in front of the member.

Here is different version of MyClass −

class MyClass {
   protected $car = "skoda";
   $driver = "SRK";

   function __construct($par) {
      // Statements here run every time
      // an instance of the class
      // is created.
   }
   
   function myPublicFunction() {
      return("I'm visible!");
   }
   
   protected function myPrivateFunction() {
      return("I'm  visible in child class!");
   }
}

Interfaces

Interfaces are defined to provide a common function names to the implementers. Different implementors can implement those interfaces according to their requirements. You can say, interfaces are skeletons which are implemented by developers.

As of PHP5, it is possible to define an interface, like this −

interface Mail {
   public function sendMail();
}

Then, if another class implemented that interface, like this −

class Report implements Mail {
   // sendMail() Definition goes here
}

Constants

A constant is somewhat like a variable, in that it holds a value, but is really more like a function because a constant is immutable. Once you declare a constant, it does not change.

Declaring one constant is easy, as is done in this version of MyClass −

class MyClass {
   const requiredMargin = 1.7;
   
   function __construct($incomingValue) {
      // Statements here run every time
      // an instance of the class
      // is created.
   }
}

In this class, requiredMargin is a constant. It is declared with the keyword const, and under no circumstances can it be changed to anything other than 1.7. Note that the constant’s name does not have a leading $, as variable names do.

Abstract Classes

An abstract class is one that cannot be instantiated, only inherited. You declare an abstract class with the keyword abstract, like this −

When inheriting from an abstract class, all methods marked abstract in the parent’s class declaration must be defined by the child; additionally, these methods must be defined with the same visibility.

abstract class MyAbstractClass {
   abstract function myAbstractFunction() {
   }
}

Note that function definitions inside an abstract class must also be preceded by the keyword abstract. It is not legal to have abstract function definitions inside a non-abstract class.

Static Keyword

Declaring class members or methods as static makes them accessible without needing an instantiation of the class. A member declared as static can not be accessed with an instantiated class object (though a static method can).

Try out following example −

<?php
   class Foo {
      public static $my_static = 'foo';
      
      public function staticValue() {
         return self::$my_static;
      }
   }
	
   print Foo::$my_static . "\n";
   $foo = new Foo();
   
   print $foo->staticValue() . "\n";
?>	

Final Keyword

PHP 5 introduces the final keyword, which prevents child classes from overriding a method by prefixing the definition with final. If the class itself is being defined final then it cannot be extended.

Following example results in Fatal error: Cannot override final method BaseClass::moreTesting()

<?php

   class BaseClass {
      public function test() {
         echo "BaseClass::test() called<br>";
      }
      
      final public function moreTesting() {
         echo "BaseClass::moreTesting() called<br>";
      }
   }
   
   class ChildClass extends BaseClass {
      public function moreTesting() {
         echo "ChildClass::moreTesting() called<br>";
      }
   }
?>

Calling parent constructors

Instead of writing an entirely new constructor for the subclass, let’s write it by calling the parent’s constructor explicitly and then doing whatever is necessary in addition for instantiation of the subclass. Here’s a simple example −

class Name {
   var $_firstName;
   var $_lastName;
   
   function Name($first_name, $last_name) {
      $this->_firstName = $first_name;
      $this->_lastName = $last_name;
   }
   
   function toString() {
      return($this->_lastName .", " .$this->_firstName);
   }
}
class NameSub1 extends Name {
   var $_middleInitial;
   
   function NameSub1($first_name, $middle_initial, $last_name) {
      Name::Name($first_name, $last_name);
      $this->_middleInitial = $middle_initial;
   }
   
   function toString() {
      return(Name::toString() . " " . $this->_middleInitial);
   }
}

In this example, we have a parent class (Name), which has a two-argument constructor, and a subclass (NameSub1), which has a three-argument constructor. The constructor of NameSub1 functions by calling its parent constructor explicitly using the :: syntax (passing two of its arguments along) and then setting an additional field. Similarly, NameSub1 defines its non constructor toString() function in terms of the parent function that it overrides.

NOTE − A constructor can be defined with the same name as the name of a class. It is defined in above example.

Below are Top 10 Key Features of Laravel Framework, that made it distant from others.

1. It’s Modularity

In Software Industry, Modularity refers to a degree in which a large system or application components/modules may be divided into smaller components and recombined.In Modularity, you can split your business logic into different parts which belong to single Entity.Laravel provides modular development approach in form of Packages that are pluggable.

2. Authentication

Authentication is one of the most important part of any web application, developers spent enormous time writing the authentication code again & again.Laravel 5 provide simple inbuilt authentication that can be easily integrated with your Laravel application by running few artisan commands.

3. Application Logic

In Laravel Application logic is written in Controllers or directly in routes.

4. Caching

Caching is used for storage of data on a temporary basis for a while and can be retrieved quickly.Using caching can reduce the load on the database server.Laravel provides an expressive, unified API to interact with the various caching backends.Laravel supports caching backends like Memcached and Redis that are easily configured with Laravel.

5. Method or Dependency Injection

Laravel’s service container is a powerful tool for managing class dependencies and performing dependency injection in the application. Dependency injection is a fancy phrase that essentially means this: class dependencies are “injected” into the class via the constructor or, in some cases, “setter” methods.(source https://laravel.com/docs/5.5/container)

6.Routing

In Laravel Routing is used for attaching Application URLs to a specific controller action or view.In Laravel 5.4 all routes are defined in your route files under routes folder. A basic route in Laravel takes an URL and a Closure function.you can read more about routing from https://laravel.com/docs/5.5/routing.

7.Automatic Pagination

Laravel has inbuilt paginations, that elimate the headache of writting code for paginating records

8.Template Engine

Blade is a simple, yet powerful templating engine provided with Laravel. Unlike other popular PHP templating engines, Blade does not restrict you from using plain PHP code in your views. All Blade templates files should use the .blade.php extension.

9.Database Query Builder

Laravel’s database query builder provides a convenient, fluent interface to creating and running database queries. It can be used to perform most database operations in your application and works on all supported database systems. The Laravel query builder uses PDO parameter binding to protect your application against SQL injection attacks. There is no need to clean strings being passed as bindings.

10.Eloquent ORM

In Laravel Eloquent is ORM that implements Active Records.Active Record Implementation is an architectural pattern found in software engineering that stores in-memory object data in relational databases.

What is C Programming Language?

C is a procedural programming language. It was initially developed by Dennis Ritchie between 1969 and 1973. It was mainly developed as a system programming language to write operating system. The main features of C language include low-level access to memory, simple set of keywords, and clean style, these features make C language suitable for system programming like operating system or compiler development.
Many later languages have borrowed syntax/features directly or indirectly from C language. Like syntax of Java, PHP, JavaScript and many other languages is mainly based on C language. C++ is nearly a superset of C language (There are few programs that may compile in C, but not in C++).

Top MySql Interview Questions And Answers

Top MySql Interview Questions And Answers

1. Compare MySQL Vs. SQL Server

2. What is SQL Server?

SQL Server is   one of the Database Management Systems (DBMS) and is designed by Microsoft.  DBMS are computer software applications with the capability of interacting with user, various other applications as well as the database itself. The objective is capturing and analyzing data and manages definition, querying, creation, updating as well as administration of database.

3. How and why use it?

SQL Server is free and anyone can download and use it. The application uses SQL (Structured Query Language) and is easy to use.

CriteriaMySQLSQL Server
Targeted towardsInternet servers & Open Source softwareCorporate & Enterprise market
FunctionalitySpeedAdministration, Graphical data modelling
Works withAssumes internet accessAdministration, Graphical data modelling

4. What are the features of MySQL?

MySQL provides cross-platform support, wide range of interfaces for application programming and has many stored procedures like triggers and cursors that helps in managing the database.

5. What is traditional Network Library for the system?

In either Windows or POSIX systems the named pipes provide ways of inter-process communications to connect different processes running on the same machine. It dispenses with the necessity of using the network stack and data can be sent without affecting the performance. Servers set up named pipes to listen to requests. Client process needs to know the specific pipe name to send the request.

6. What is the default port for MySQL Server?

The default port for MySQL Server is 3306. Another standard default is port 1433 in TCP/IP for SQL Server.

7. What do DDL, DML, and DCL stand for?

DDL is the abbreviation for Data Definition Language dealing with database schemas as well as the description of how data resides in the database. An example is CREATE TABLE command. DML denotes Data Manipulation Language such as SELECT, INSERT etc. DCL stands for Data Control Language and includes commands like GRANT, REVOKE etc.

8. What are meant by Joins in MySQL?

In MySQL the Joins are used to query data from two or more tables. The query is made using relationship between certain columns existing in the table. There are four types of Joins in MySQL. Inner Join returns the rows if there is at least one match in both the tables. Left Join returns all the rows form the left table even if there is no match in the right table. Right Join returns all the rows from the right table even if no matches exist in left table. Full Join would return rows when there is at least one match in the tables.

9. What are the common MySQL functions?

Common MySQL functions are as follows: • NOWO – function for returning current date and time as single value. • CURRDATEO – function for returning the current date or time. • CONCAT (X, Y) – function to concatenates two string values creating single string output. • DATEDIFF (X, Y) – function to determine difference two dates.

10. What is the difference between CHAR and VARCHAR?

When the table is created, CHAR is used to define the fixed length of the table and columns. The length value could be in the range of 1-255. VARCHAR command is given to adjust the column and table length as required.

11. What are HEAP Tables?

Basically HEAP tables are in-memory and used for high speed temporary storages. But TEXT or BLOB fields are not allowed within them. They also do not support AUTO INCREMENT.

12. What is the syntax for concatenating tables in MySQL?

The syntax for concatenating tables is MySQL is CONCAT (string 1, string 2, string 3)

13. What are the limits for using columns to create the Index?

The maximum limits of indexed columns that could be created for any table is 16.

14. What are the different types of strings in Database columns in MySQL?

Different types of strings that can be used for database columns are SET, BLOB, VARCHAR, TEX, ENUM, and CHAR.

15. How the user can get the current SQL version?

The syntax for getting the current version of MySQL is SELECT VERSION ();

16. Is there an object oriented version of MySQL library functions?

MySQLi is the object oriented version of MySQL and it interfaces in PHP.

17. What is the storage engine for MySQL?

Storage tables are named as table types. The data is stored in the files using multiple techniques such as indexing, locking levels, capabilities and functions.

18. What is the difference between primary key and candidate key?

Primary key in MySQL is use to identify every row of a table in unique manner. For one table there is only one primary key. One of the candidate keys is the primary key and the candidate keys can be used to reference the foreign keys.

19. What are the different types of tables in MySQL?

MyISAM is the default table that is based on the sequential access method.

  • HEAP is the table that is used for fast data access but data will be lost if the table or system crashes.
  • InoDB is the table that supports transactions using the COMMIT and ROLL BACK commands.
  • BDB can support transactions similar to InoDB but the execution is slower.

20. Can you use MySQL with LINUX operating system?

Yes, the syntax for using MySQL with LINUX operating system is /etc/init.d/mysqlstart

21. What is the use of ENUM in MySQL?

Use of ENUM will limit the values that can go into a table. For instance; the user can create a table giving specific month values and other month values would not enter into the table.

22. What are the TRIGGERS that can be used in MySQL tables?

The following TRIGGERS are allowed in MySQL:• BEFORE INSERT

  • AFTER INSERT
  • BEFORE UPDATE
  •  AFTER UPDATE
  •  BEFORE DELETE
  •  AFTER DELETE

23. What is the difference between LIKE and REGEXP operators in MySQL?

  •  LIKE is denoted using the % sign. For example:SELECT * FROM user WHERE user name LIKE “%NAME”.• On the other hand the use of REGEXP is as follows:SELECT * FROM user WHERE username REGEXP “^NAME”;

24. How to use the MySQL slow query log?

Information that is provided on the slow query log could be huge in size. The query could also be listed over thousand times. In order to summarize the slow query log in an informative manner one can use the third party tool “pt-qury-digest”.

25. How can one take incremental backup in MySQL?

User can take incremental backup in MySQL using percona xtrabackup.

26. How can you change the root password if the root password is lost?

In such cases when the password is lost the user should start the DB with – skip-grants-table and then change the password. Thereafter with the new password the user should restart the DB in normal mode.

27. How to resolve the problem of data disk that is full?

When the data disk is full and overloaded the way out is to create and soft link and move the .frm as well as the .idb files into that link location.

28. What is the difference between DELETE TABLE and TRUNCATE TABLE commands in MySQL?

Basically DELETE TABLE is logged operation and every row deleted is logged. Therefore the process is usually slow. TRUNCATE TABLE also deletes rows in a table but it will not log any of the rows deleted.  The process is faster in comparison. TRUNCATE TABLE can be rolled back and is functionally similar to the DELETE statement using no WHERE clause.

29. What are types of joins in MySQL?

There are four types of Joins in MySQL. Inner Join returns the rows if there is at least one match in both the tables. Left Join returns all the rows form the left table even if there is no match in the right table. Right Join returns all the rows from the right table even if no matches exist in left table. Full Join would return rows when there is at least one match in the tables.

30.What are the storage models of OLAP?

The storage models in OLA are MOLAP, ROLAP, and HOLAP.

31. How to define testing of network layers in MySQL?

For this it is necessary reviewing the layered architecture and determining hardware and software configuration dependencies in respect of the application put to test.

32. What is the difference between primary key and unique key?

While both are used to enforce uniqueness of the column defined but primary key would create a clustered index whereas unique key would create non-clustered index on the column. Primary key does not allow ‘NULL’ but unique key allows it.

33. What is meant by transaction and ACID properties?

Transaction is logical unit of work where either all or none of the steps should be performed. ACID is the abbreviation for Atomicity, Consistency, Isolation, and Durability that are properties of any transaction.

34. How can one restart SQL Server in single user or minimal configuration modes?

The command line SQLSERVER.EXE used with –m will restart SQL Server in single user mode and with –f will start it in minimal configuration mode.

35. What is the difference between BLOB and TEXT?

BLOBs are binary large object holding huge data. 4 types of BLOB are TINYBLOB, BLOB, MEDIBLOB, and LONGBLOB. TEXT is case-sensitive BLOB. 4 types of TEXT are TINY TEXT, TEXT, MEDIUMTEXT, and LONG TEXT.

36. What is the basic MySQL architecture?

The logical architecture of MySQL is made of ‘connection manager’, ‘query optimizer’, and ‘pluggable engines’.

PHP Interview Questions And Answers

PHP Interview Questions And Answers

Q) What are the basic differences among Php,Python and Ruby

PHP Vs Ruby Vs Python
PHP Ruby Python
To build dynamic web pages To make programming fun and flexible
Improve productivity and code readability
Version 7.2 Ruby 2.5.1 Python 3.6.4
Free Software Released Under PHP License Open Source and works on multiple platforms
Easy and quick to learn
Easy to learn Can be embedded into HTML
Runs in multiple systems and platforms
Great number of extensions and source codes A very high level language
Readable and organized syntax
Provides extensive DB Support Can be easily connected to DB2, MySql, Oracle and Sybase
Not so effective in dealing with DB Connections

Q1) What is PHP?

PHP is a server side scripting language commonly used for web applications. PHP has many frameworks and cms for creating websites.Even a non technical person can cretae sites using its CMS.WordPress,osCommerce are the famus CMS of php.It is also an object oriented programming language like java,C-sharp etc.It is very eazy for learning

Q2) What is the use of “echo” in php?

It is used to print a data in the webpage, Example: , The following code print the text in the webpage

Q3) How to include a file to a php page?

We can include a file using “include() ” or “require()” function with file path as its parameter.

Q4) What’s the difference between include and require?

If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.

Q5) require_once(), require(), include().What is difference between them?

require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page). So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example. This way you make sure you don’t include the file more times and you will not get the “function re-declared” error.

Q6) Differences between GET and POST methods ?

We can send 1024 bytes using GET method but POST method can transfer large amount of data and POST is the secure method than GET method .

Q7)How to declare an array in php?

Eg : var $arr = array(‘apple’, ‘grape’, ‘lemon’);



Q8) What is the use of ‘print’ in php?

This is not actually a real function, It is a language construct. So you can use with out parentheses with its argument list.
Example print(‘PHP Interview questions’);
print ‘Job Interview ‘);

Q9) What is use of in_array() function in php ?

in_array used to checks if a value exists in an array
What is use of count() function in php ?
count() is used to count all elements in an array, or something in an object

Q10) What’s the difference between include and require?

It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.

Q11) What is the difference between Session and Cookie?

The main difference between sessions and cookies is that sessions are stored on the server, and cookies are stored on the user’s computers in the text file format. Cookies can not hold multiple variables,But Session can hold multiple variables.We can set expiry for a cookie,The session only remains active as long as the browser is open.Users do not have access to the data you stored in Session,Since it is stored in the server.Session is mainly used for login/logout purpose while cookies using for user activity tracking

Q12) How to set cookies in PHP?

Setcookie(“sample”, “ram”, time()+3600);

Q13) How to Retrieve a Cookie Value?

eg : echo $_COOKIE[“user”];

Q14) How to create a session? How to set a value in session ? How to Remove data from a session?

Create session : session_start();
Set value into session : $_SESSION[‘USER_ID’]=1;
Remove data from a session : unset($_SESSION[‘USER_ID’];

Q15) What types of loops exist in php?

for,while,do while and foreach (NB: You should learn its usage)

Q16) How to create a mysql connection?

mysql_connect(servername,username,password);

Q17) How to select a database?

mysql_select_db($db_name);

Q18) How to execute an sql query? How to fetch its result ?

$my_qry = mysql_query(“SELECT * FROM `users` WHERE `u_id`=’1′; “);
$result = mysql_fetch_array($my_qry);
echo $result[‘First_name’];

Q19) Write a program using while loop

$my_qry = mysql_query(“SELECT * FROM `users` WHERE `u_id`=’1′; “);
while($result = mysql_fetch_array($my_qry))
{
echo $result[‘First_name’.].”
”;
}

Q20) How we can retrieve the data in the result set of MySQL using PHP?

mysql_fetch_row
mysql_fetch_array
mysql_fetch_object
mysql_fetch_assoc

Q21) What is the use of explode() function ?

Syntax : array explode ( string $delimiter , string $string [, int $limit ] );
This function breaks a string into an array. Each of the array elements is a substring of string formed by splitting it on boundaries formed by the string delimiter.

Q22) What is the difference between explode() and split() functions?

Split function splits string into array by regular expression. Explode splits a string into array by string.

Q23) How to redirect a page in php?

The following code can be used for it, header(“Location:index.php”);

Q24) How stop the execution of a php scrip ?

exit() function is used to stop the execution of a page

Q25) How to set a page as a home page in a php based site ?

index.php is the default name of the home page in php based sites

Q26) What is the difference between mysql_fetch_array() and mysql_fetch_assoc() ?

mysql_fetch_assoc function Fetch a result row as an associative array, Whilemysql_fetch_array() fetches an associative array, a numeric array, or both

Q27) What is the importance of “method” attribute in a html form?

“method” attribute determines how to send the form-data into the server.There are two methods, get and post. The default method is get.This sends the form information by appending it on the URL.Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.

Q28) What is the importance of “action” attribute in a html form?

The action attribute determines where to send the form-data in the form submission.

Q30) What is the use of “enctype” attribute in a html form?

The enctype attribute determines how the form-data should be encoded when submitting it to the server. We need to set enctype as “multipart/form-data”when we are using a form for uploading files.

Q31) Define Object-Oriented Methodology

Object orientation is a software/Web development methodology that is based on the modeling a real world system.An object is the core concept involved in the object orientation. An object is the copy of the real world enity.An object oriented model is a collection of objects and its inter-relationships.

Q32) How do you define a constant?

Using define() directive, like define (“MYCONSTANT”,150)

Q33) Difference between mysql_connect and mysql_pconnect?

There is a good page in the php manual on the subject, in short mysql_pconnect() makes a persistent connection to the database which means a SQL link that do not close when the execution of your script ends. mysql_connect()provides only for the databasenewconnection while using mysql_pconnect , the function would first try to find a (persistent) link that’s already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection… the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use.

Q34) What is the use of “ksort” in php?

It is used for sort an array by key in reverse order.

Q35) What is the difference between $var and $$var?

They are both variables. But $var is a variable with a fixed name. $$var is a variable who’s name is stored in $var. For example, if $var contains “message”, $$var is the same as $message.

Q36) What are the different types of errors in PHP ?

Here are three basic types of runtime errors in PHP:
Notices: These are trivial, non-critical errors that PHP encounters while executing a script – for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all – although you can change this default behavior.
Warnings: These are more serious errors – for example, attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination.
Fatal errors: These are critical errors – for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP’s default behavior is to display them to the user when they take place.

Q37) What is PEAR?

PEAR is a framework and distribution system for reusable PHP components.The project seeks to provide a structured library of code, maintain a system for distributing code and for managing code packages, and promote a standard coding style.PEAR is broken into three classes: PEAR Core Components, PEAR Packages, and PECL Packages. The Core Components include the base classes of PEAR and PEAR_Error, along with database, HTTP, logging, and e-mailing functions. The PEAR Packages include functionality providing for authentication, networking, and file system features, as well as tools for working with XML and HTML templates.

Q38) Distinguish between urlencode and urldecode?

This method is best when encode a string to used in a query part of a url. it returns a string in which all non-alphanumeric characters except -_. have replece with a percentege(%) sign . the urldecode->Decodes url to encode string as any %and other symbole are decode by the use of the urldecode() function.

Q39) What are the different errors in PHP?

In PHP, there are three types of runtime errors, they are:

Warnings: 
These are important errors. Example: When we try to include () file which is not available. These errors are showed to the user by default but they will not result in ending the script.

Notices:
These errors are non-critical and trivial errors that come across while executing the script in PHP. Example: trying to gain access the variable which is not defined. These errors are not showed to the users by default even if the default behavior is changed.

Fatal errors: 
These are critical errors. Example: instantiating an object of a class which does not exist or a non-existent function is called. These errors results in termination of the script immediately and default behavior of PHP is shown to them when they take place. Twelve different error types are used to represent these variations internally.

Top PHP Interview Questions And Answers

Top PHP Interview Questions And Answers

1. Compare PHP & JAVA
Criteria PHP Java
Deployment area Server-side scripting General purpose programming
Language type Dynamic typed Static typed
Rich set of APIs No Yes
2. How can we encrypt password using PHP?

crypt () function is used to create one way encryption. It takes one input string and one optional parameter. The function is defined as: crypt (input_string, salt), where input_string consists of the string that has to be encrypted and salt is an optional parameter. PHP uses DES for encryption. The format is as follows:

php code
3. Explain how to submit a Form without a submit button.

A form can be posted or submitted without the button in the following ways:

1. On OnClick event of a label in the form, a JavaScript function can be called to submit the form.
Example:

               document.form_name.submit()

2. Using a Hyperlink: On clicking the link, JavaScript function can be called.

Example:

Q5 php IQA code

A form can be submitted in these other ways without using submit button.

  • Submitting a form by clicking a link
  • Submitting a form by selecting an option from drop down box with the invocation of onChange event
  • Using java script : document.form.submit();
  • Using header(“location:page.php”);
4. How can we increase the execution time of a PHP script?
  • Default time allowed for the PHP scripts to execute is 30 secs mentioned in the php.inifile. The function used is set_time_limit(int sec). If the value passed is ‘0’, it takes unlimited time. It should be noted that if the default timer is set to 30 sec, and 20 sec is specified in set_time_limit(), the script will run for 45 seconds.
  • This time can be increased by modifying the max_execution_time in secs. The time must be changed keeping the environment of the server. This is because modifying the execution time will affect all the sites hosted by the server.
  • The script execution time can be increased by
  1. Using sleep() function in PHP script
  2. Using set_time_limit() function
  3. The default limit is 30 seconds. The time limit can be set to zero to impose no time limit to pause.
5. What is Zend Engine?
  • Zend Engine is used internally by PHP as a compiler and runtime engine. PHP Scripts are loaded into memory and compiled into Zend opcodes.
  • These opcodes are executed and the HTML generated is sent to the client.
  • The Zend Engine provides memory and resource management, and other standard services for the PHP language. Its performance, reliability and extensibility played a significant role in PHP’s increasing popularity.
6. What library is used for pdf in PHP?

The PDF functions in PHP can create PDF files using the PDFlib library Version 6. PDFlib offers an object-oriented API for PHP 5 in addition to the function-oriented API for PHP 4.
There is also the » Panda module. FPDF is a PHP class, which allows generating PDF files with pure PHP (without using the PDFlib library.)
F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs. FPDF requires no extension (except zlib to activate compression and GD for GIF support) and works with PHP4 and PHP5.

7. What are some new features introduced in PHP7?
  1. Zend Engine 3 performance improvements and 64-bit integer support on Windows
  2. uniform variable syntax AST-based compilation process
  3. added Closure::call()
  4. bitwise shift consistency across platforms
  5. (null coalesce) operator
  6. Unicode codepoint escape syntax
  7. return type declarations
  8. and scalar type (integer, float, string and boolean) declarations.
8. What is htaccess? Why do we use this and where?
  • htaccess files are configuration files of Apache Server that provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.
  • These .htaccess files are used to change the functionality and features of Apache web server.
    For instance, htaccess file is used for url rewrite.
    –> It is used to make the site password protected.
    –> .htaccess file can restrict some ip addresses so that on restricted ip addresses, the site will not open.
9. What are magic methods?
  • Magic methods are member functions that are available to all the instance of class. Magic methods always start with “__”. Eg. __construct.
  • All magic methods need to be declared as public
  • To use a method, it should be defined within the class or program scope
  • Various Magic Methods used in PHP 5 are: __construct() __destruct() __set() __get() __call() __toString() __sleep() __wakeup() __isset() __unset() __autoload() __clone().

10. What is meant by PEAR in PHP?

PEAR is an acronym for “PHP Extension and Application Repository” The purpose of PEAR is to provide:

  • A structured library of open-sourced code for PHP users
  • A system for code distribution and package maintenance
  • A standard style for writing code in PHP
  • PHP Foundation Classes (PFC)
  • PHP Extension Community Library (PECL)
  • A website, mailing lists and download mirrors to support the PHP/PEAR community
11. Explain soundex() and metaphone().

soundex()
The soundex() function calculates the soundex key of a string. A soundex key is a four character long alphanumeric strings that represents English pronunciation of a word. The soundex() function can be used for spelling applications.

$str= “hello”;
Echo soundex($str);
?>

metaphone()
the metaphone() function calculates the metaphone key of a string. A metaphone key represents how a string sounds if pronounced by an English person. This function can also be used for spelling applications.

echo metaphone(“world”);
?>
12. What is smarty?

Smarty is a template engine written in PHP. Typically, these templates will include variables —like {$variable} — and a range of logical and loop operators to allow adaptability within of the template.

13. What is Memcache?





Memcache is a technology that caches objects in memory such that your web application can get to them really fast. It is used by sites such as Digg.com, Facebook.com and NowPublic.com and is widely recognized as an essential ingredient in scaling any LAMP.
14. How can we execute a PHP script using command line?
  • Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, “php myScript.php”, assuming “php” is the command to invoke the CLI program.
  • Remember that if your PHP script was written for the Web CGI interface, it may not execute properly in command line environment.

Advanced Questions

1. How to scrape data from website using CURL?

To scrap the data from website, Website must be public and open for scrapable.
In the blow code, just update the CURLOPT_URL to which websites data you want to scrap.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.web-technology-experts-notes.in/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
2. Explain the difference between $message and $$message?
  • $message is used to store variable data. $$message can be used to store variable of a variable. Data stored in $message is fixed while data stored in $$message can be changed dynamically.
    Example:
$var1 = ‘Variable 1’
$var1= ‘variable2’
This can be interpreted as $ Variable 1=‘variable2’;
For me to print value of both variables, I will write
$var1 $($var1)
  • $message is a variable and $$message is a variable of another variable.
    Example
$Message = "YOU";
$you= "Me";
echo $message //Output:- you
echo $message //output :-Me

$$message allows the developer to change the name of the variable dynamically.

3. How urlencode and urldecode can be used?

Urlencode can be used to encode a string that can be used in a url. It encodes the same way as posted data from web page is encoded. It returns the encoded string.
Syntax:

urlencode (string $str )

urlencode () is the function that can be used conveniently to encode a string before using in a query part of a URL. This is a convenient way for passing variables to the next page.
Syntax:

urldecode (string $str )

urldecode() is the function that is used to decode the encoded string. Urldecode can be used to decode a string. Decodes any %## encoding in the given string (Inserted by urlencode.)

4. How to set HTTP header to UTF-8 using?

header(‘Content-Type: text/html; charset=utf-8’);

5. Which PHP Extension help to debug the code?

Xdebug: – It uses the DBGp debugging protocol for debugging.
The debug information that Xdebug can provide includes the following:

  • stack and function traces in error messages with:
  • full parameter display for user defined functions
  • function name, file name and line indications
  • support for member functions
  • memory allocation
  • protection for infinite recursions

Xdebug also provides:

  • profiling information for PHP scripts
  • code coverage analysis
  • Capabilities to debug your scripts interactively with a debugger front-end.[4]
    Xdebug is also available via PECL

6. How can I execute an anonymous function?

call_user_func(function() { echo ‘anonymous function called.’; });

7. Explain how to send large amounts of emails using PHP.

There are different methods through which we can send mails in PHP. They are as follows:

  1. PHP mail() function
    It implicitly sends a message to SMTP server, which is configured in the php.ini file. This function is used by the base class of MIME message composing and sending package.
  2. SMTP server relay
    They are used to relay the messages to an intermediate SMTP server. This server stores the messages temporarily and will try to deliver them in the destination SMTP server.
  3. Sending urgent messages by doing direct delivery to the destination SMTP server
    A variable named direct_delivery is provided by the smtp_message_class sub-class, which connects to the destination SMTP server and sends the message directly.
8. Explain how to get DNS servers of a domain name.
  • Include Net/DNS.php file in the beginning of the script
  • Create an object for DNS resolver by using $ndr = Net_DNS_Resolver()
  • Query the ip address using $ndr->search(“somesite.com”,”A”) and assign to a relevant variable. Ex: $result
  • Now, display the value of $result
9. How can I measure the speed of code written in PHP?

$startTime= microtime(true);
/** Write here you code to check **/
/** Write here you code to check **/
$endTime= microtime(true);
echo ‘Time Taken to execute the code:’.$endTime-$startTime

10. How can we resolve maximum allocation time exceeds error?

We can resolve these errors through php.ini file or through .htaccess file.

  1. From php.ini file, increase the max_execution_time =360 (or more according to need)
    and change memory_limit =128M (or more according to need)
  2. From php file, we can increase time by writing ini_set(‘max_execution_time’,360 ) at top of php page to increase the execution time.And to change memory_limit write ini_set(‘memory_limit ,128M )
  3. From .htaccess file, we can increase time and memory by:
Q15 php IQA code
11. In how many ways can you retrieve data in the result set of MySQL using PHP? What is the difference between mysql_fetch_object and mysql_fetch_array?

We can retrieve data in the result set of MySQL using PHP in four Ways

  1. mysqli_fetch_row >> Get a result row as an enumerated array
  2. mysqli_fetch_array >> Fetch a result row as associative and numeric array
  3. mysqli_fetch_object >> Returns the current row of a result set as an object
  4. mysqli_fetch_assoc >> Fetch a result row as an associative array
    mysqli_fetch_object() is similar to mysqli_fetch_array(), with one difference –
    an object is returned instead of an array, which implies that that we can only access the data by the field names, and not by their offsets (numbers are illegal property names).
12. Can we use include (“xyz.PHP”) two times in a PHP page “index.PHP”?

How can we destroy a session in PHP
Yes, we can include (“xyz.php”) more than one time in any page. But it creates a problem when a xyz.php file contains some function declaration- an error occurs due to an already present function in this file. Otherwise, there is no problem, for instance if you want to show same content two times in the page then you must include it two times.

13. How do we change a password for an existing user via mysqladmin?

mysqladmin -u root -p password “newpassword”

14. How to Get the Uploaded File Information in the Receiving Script?

Once the Web server received the uploaded file, it will call the PHP script specified in the form action attribute to process them. This received PHP script can get the uploaded file information through a predefined array called $_FILES. Uploaded file information is organized in $_FILES as a two-dimensional array as:

  • $_FILES[$fieldName][‘name’] : Original file name on the browser system.
  • $_FILES[$fieldName][‘type’] : the file type determined by the browser.
  • $_FILES[$fieldName][‘size’] : Number of bytes of the file content.
  • $_FILES[$fieldName][‘tmp_name’] : a temporary filename of the file in which the uploaded file was stored on the server.
  • $_FILES[$fieldName][‘error’] an error code associated with this file upload.
  • The $fieldName is the name used in the <INPUT,>.
15. How to protect Special Characters in Query String?

If you want to include special characters like spaces in the query string, you need to protect them by applying the urlencode() translation function. The script below shows how to use urlencode():

Q30 php IQA code
16. How can we destroy a session in PHP?

We can destroy a session by:

Q22 part 1 php IQA code

To delete a specific session variable, we use

Q22 part 2 php IQA code

17. What will be the output of following?

function changevalue(&$y)  {  $y = $y + 7;  }  $num = 8;   
changevalue($num);   
echo $num;

It would be: 15
Reference will take the value and will add 5 to it.