Top PHP Interview Questions with Answers For Job


  What is PHP?

    PHP is a server side scripting language  used for web development applications.
    Php is the powerful tool for making dynamic website.
    Many open source, free and commercial scripts    and   Stuff made by php

 What is a data type?

A Data type is the classification of data into a category according to its attributes;
• Alphanumericcharacters are classified as strings
• Whole numbersare classified integers
• Numberswith decimal pointsare classified as floating points.
• True or falsevalues are classified as Boolean.
PHP is a loosely typed language;it does not have explicit defined data types.






What is a variable?

A variable is a name given to a memory location that stores data at runtime.
 The scope of a variable determines its visibility.
A global variable is accessible to all the scripts in an
application. A local variable is only accessible to the script
that it was defined in.

How to retrieve a secure URL?
To retrieve secure URLs, the cURL extension needs access to an SSL library, such as OpenSSL.
<?php
$c = curl_init('https://secure.example.com/accountbalance.php');
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
 $page = curl_exec($c); curl_close($c);
?>



Why you should use variables?

Variables help separate data from the program algorithms. The same algorithm can be used
for different input data values. For example, suppose that you are developing a calculator
program that adds up two numbers, you can create two variables that accept the numbers
then you use the variables names in the expression that does the addition.


  How to show all PHP runtime errors?
 
   Add error_reporting function set  1 .

  What is htaccess?

   .htaccess files are configuration files of Apache Server which provide
   a way to make configuration changes on a per-directory basis.

How to redirect a user to a page?

header('Location: http://www.example.com/');
The redirect URL must include the protocol and hostname.




   What is  echo in php?

    It is a keyword.
    It is used to print  data on the webpage, like that <?php echo 'test'; ?> ,
  
    How to include a file to a php page?

    Add include a file using include() or require() function with the path.


    What's the difference between include and require?

    PHP provides two constructs to load code and HTML from another module: require and include.
    They both load a file as the PHP script runs, work in conditionals and loops, and complain if
    the file being loaded can't be found. The main difference is that attempting to require a
   nonexistent file is a fatal error, while attempting to include such a file produces a warning
    but does not stop script execution.

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

    will not get the "function re-declared" error.
   
    Differences between GET and POST methods ?
    A GET request encodes the form parameters in the URL, in what is called a query string:

    /path/to/chunkify.php?word=despicable&length=3
    A POST request passes the form parameters in the body of the HTTP request, leaving the URL untouched.
    POST requests are not idempotent. This means that they cannot be cached,
    and the server is recontacted every time the page is displayed.

    How to declare an array php?

    Example : var $arr = array('ie', 'firefox', 'safari');

    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.
   


    What is  in_array() function?

    The in_array( ) function returns true or false, depending on whether the first
     argument is an element in the array given as the second argument.
    in_array used to checks if a value exists in an array that Searching for Values of array.
   
    What is count() function in php ?

    The count( ) and sizeof( ) functions are identical in use and effect.
    They return the number of elements in the array.


    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.


    What is the difference between Session and Cookie?

    sessions are stored on the server, and cookies are stored on the client’s computers in the text file format.
    A cookie is a bit of information that the server can give to a client.
    Every session has a data store associated with it. You can register variables to be loaded
    from the data store when each page starts and saved back to the data store when the page ends.
   

   How to set cookies in PHP?

    Setcookie("test", "sem", time()+3600);
   

    How to Retrieve a Cookie Value?
     echo $_COOKIE["test"];
   

    How to create a session? 

    Create session by  session_start();

   How to set a value in session ?

    Set value into session by  $_SESSION['test_ID']=1987654;

   How to Remove data from a session?

   Remove data from  session -> session_unset($_SESSION['test_ID'];



    How to create a mysql connection?
    call mysql_connect(servername,username,password);


    How to select a database?

    call mysql_select_db($db_name);

    How to execute an sql query? How to fetch its result ?
    $my_qry = mysql_query("SELECT * FROM `test` WHERE `test_id`='16'; ");
    $result = mysql_fetch_array($my_qry);
    echo $result['First_test_name'];


    How to get the resultset of MySQL using PHP?
        1. mysql_fetch_row
        2. mysql_fetch_array
        3. mysql_fetch_object
        4. mysql_fetch_assoc
   
       
   
    How to strip whitespace or other characters from the beginning and end of a string ?

    The trim() function removes whitespaces or other predefined characters from both sides of a string.
   
    What is the use of header() function in php ?

    The header() function sends a raw HTTP header to a client browser.
    Remember that this function must be called before sending the actual out put.
    For example, You do not print any HTML element before using this function.
   
    How to redirect a page in php?

    The following code can be add for it, header("Location:test.php");
   
    How stop the execution of a php scrip ?

    exit() function  stop the execution of a page.
   
   
    How to get the length of a string?

    strlen() function  gives  the length of a string


    How to generate random numbers in php?

    Add rand function  to generate random numbers.

    How  to varify a variable in php?

    This is_set  function is used to determine if a variable is set and is not .   

      
    What is mean by an associative array?

    Associative arrays are arrays that indexed by string keys is called associative arrays.


   
   
    How do you define a constant?

    Using define() directive, like  that define ("MYCONSTANT",765754);
   
   
    How send email using php?

    To send email using PHP, you use the mail() function.This mail() function accepts 5 parameters

    How to find current date and time?

    The date() function gives  the current date and time .
  
       
    What is the use of ksort in php?

    Its  sort an array by key in reverse order.
  
  Who is the father of PHP ?

  Rasmus Lerdorf is known as the father of PHP.     
       
    How to delete a file from the system?

    Unlink() deletes the  file from the file system.
   
    How to get the value of current session id?

    session_id() function gives the session id for the current session.


What is the difference between $name and $$name?

$name is variable where as $$name is reference variable
like $name=sonia and $$name=singh so $sonia value is singh.

  mysql_fetch_object vs  mysql_fetch_array?

mysql_fetch_object() is similar tomysql_fetch_array(), with one difference - an object is returned, instead of an array. Indirectly, that means that you can only access the data by the field names, and not by their offsets numbers are illegal property names

In PHP for pdf which library used?. 

The PDF functions in PHP can create PDF files using the PDFlib library With 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 to generate PDF files with pure PHP, that is to say 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.
 
How  to Connecting two Strings? 
a useful concept—concatenation. It refers to the process of linking
items together. Specifically in programming, you concatenate strings.
The period . is the operator for performing this action, and it's used like so:

$tString = $String1 . $bString2;

echo $tString;





Why we use strstr?
strstr returns all of string after the first occurrence of substring .
If substring doesn't exist in string , the function returns FALSE.

How to  capitalize only the first character of a string?
you use ucfirst:
$txt = "welcome to the this site";
echo $ucfirst($txt);
 
What three components need to create a dynamic web page? 
A web server, a server-side programming language, and a database.

What does Apache use to load extensions?

Modules.

What does the PHP Interpreter do?
 It processes the HTML and PHP files.

What's a more secure function than md5() for encoding passwords? 
The sh1() function creates a 160-bit key instead of md5()'s 128-bit string. 
It also uses a superior algorithm for making it difficult to determine the 
values that generate a particular encoding.

What are the advantages of using PEAR?
 The PEAR functions are more compact, and they automate some of the manual
 work of connecting to and selecting from the database. Because PEAR code
 is used by many developers, it is less likely to have an error than to have code
 that's written from scratch.

Learn Php Code
 
PHP Functions
Php tutorial - imagemagick
php.ini Basics
PHP Sessions
Cookies Versus Sessions
PHP Web-Related Variables
PHP ERRORS
maximum size of a file uploaded
Php Image upload
php file_get_contents
MySQL Data on the Web
What are GET and POST
php and pdf
$_ENV and $_SERVER
PEAR with php
SELECTING DATA PHP
prevent hijacking with PHP
LAMP
PHP MySQL Functions
PHP Zip File Functions
Substrings PHP
PHP Variable names
PHP magic methods
How to get current session id
Add variables into a session
$_GET , $_POST,$_COOKIE
different tables present in mysql
PHP CURL
php Sessions page
PHP-sorting an array
PHP-count the elements of array
Operators for If/Else Statements
PHP file uploading code
PHP global variables
Testing working using phpinfo
PHP Code for a Valid Number
PHP-Associative Arrays
PHP mvc tutorial
PHP get_meta_tags-Extracts
difference between print and echo
PHP best tutorial-PHP variables
Reading DOC file in PHP
PHP interview questions
convert time PHP
PHP implode array elements
header function-PHP
PHP-Renaming Files Directories
PHP Classes
in_array function in PHP
keep your session secure PHP
Web Application with PHP
What is SQL Injection
PHP-extract part of a string
PHP urlencode
PHP- know browser properties
PHP- Extracting Substrings
Checking Variable Values /Types
PHP-best 20 Open Source cms
IP AddressPHP
PHP-Scope Resolution Operator
how create new instance of object
how eliminate an object
PHP- ob_start
XML file using the DOM API
PHP- MVC
PHP- CAPTCHA
PHP- Position of a Value in an Array
PHP-Mail Functions
PHP-difference include vs require
calculate the sum of values in an array
PHP-total number of rows
Show unique records mysql
MySQL Triggers
MySQL data directory
MySQL Subqueries
PHP- Networking Functions
PHP- Operators
Restore database
Conditional Functions mysql
PHP-function overloading
Friend function
mysql_connect /mysql_pconnect
PHP-Error Control Operators
what is IMAP
Apache-Specific Functions
Send Email from a PHP Script
SQL inherently
WAMP, MAMP, LAMP
Php tutorial-SYMBOLS
Table Types-MySQL
PHP-Encryption data management
PHP Array
Running MySQL on Windows
Maximum Performance MySQL
XML-RPC
PHP-static variables
Advanced Database Techniques
FTP
Codeigniter
Apache Pool Size
Why NoSQL
MySQL Server Performance
Database software
SQL Interview Answers
PHP Redirect
PHP Interview Questions with Answers
Advanced PHP

save youtube vedio on google drive


There’s another option available inside
 Google Takeout that will not only let you
 download your YouTube videos in their original
 high-resolution but also saves the files directly
to your Google Drive. Thus, you can start the
download process and it will save all your files,
 big and small, to Google Drive in the background.
 Once the files are in Drive, they’ll automatically
 sync to your desktop that you can later upload to
other video websites.

To get started, go to this custom link, click
the Next button and choose Add to Drive as your
 delivery method. That’s it. All you YouTube videos
will be zipped and added to the Takeout folder in
Drive in few hours. If the total size of your videos
 exceeds 2GB, it will create multiple files of 2 GB each.

Sony Android 5.0 Lollipop for Xperia Z serie


Sony's  main focus remains on the Xperia Z series.
 While most other Android smartphones are getting
the Android 5.0 Lollipop update, the owners of
Sony Xperia devices inquired about the same for
 their devices. Sony surprised everyone by stating
via its official Twitter account that the Lollipop
update will be released only for the the Xperia Z
series devices. That means, the Xperia E1, E2, C3,
M2, M2 Aqua, T3, and T2 Ultra will not be getting
 the Lollipop update. @VIVSNO Hi. We can advise
 that the Android 5.0 Lollipop update is going to be
released for the entire Xperia Z series only,
Sony Xperia (@sonyxperia) March 4, 2015 Sony
has been clear about the Lollipop update for the
 Xperia Z series since October last year

HTC E9 is comeing online

Sporting the model number A55, HTC E9
is bound to be a budget friendly version of the
 Taiwanese manufacturer's flagship, HTC One M9.
 The unannounced device will succeed HTC One E8,
 who fulfilled the same duties a year ago.

The photos appear to reveal a plastic body with
BoomSound speakers. The device's camera has
the same large circular cutout that we saw on HTC
 One M9 Plus. Previously rumored specs of HTC E9
 include MediaTek MT6795 chipset with an
octa-core 2.0GHz Cortex-A53 processor,
PowerVR G6200 GPU, and 3GB of RAM. A 5.5" QHD
 display, 20MP camera, and Android Lollipop are also
 expected on board.

web WWW action Web Page

  • Web information is stored in documents called web pages
  • Web pages are files stored on computers called web servers.
  • Computers reading the web pages are called web clients.
  • Web clients view the pages with a program called a web browser.
  • Popular browsers are Internet Explorer and Mozilla Firefox.
  • A browser fetches a page from a web server by a request.
  • A request is a standard HTTP request containing a page address.
  • An address may look like this: http://www.someone.com/page.htm.
Web Server
  • The collection of all your web pages is called your web site.
  • To let others view your work, you must publish your web site.
  • To publish your work, you must copy your site to a web server.
  • Your own PC can act as a web server if it is connected to a network.
  • Most common is to use an Internet Service Provider

If you want other people to view your web site, you must
 copy your site to a public server. Even if you can use your
own PC as a web server, it is more common to let an Internet
 Service Provider ISP host your site.
Included in a Web hosting solution you can expect
to find domain name registration and standard email services.
Open up a PPC account
Title Tag SEO Tips
Content Segment On A Page
On Page SEO Techniques
Use Email Newsletters for traffic
Off-Page SEO Strategies
SEO Tips to get more Traffic
Free SEO Tips
Four Money-Making SEO Tips for Small Business
On-page SEO and Off-page
Keywords in URLs and File Names
SEO Tutorials
Link Building Guide
Create SEO Friendly URLs
Robots.txt Optimization
SEO Internet Marketing & Good Content
Time consuming process in seo
Traffic to Your Site
Semantic Markup for seo
Seo Directories
web development
Seo Fuel
HTML-language of the web
Seo Articles Targeted Clients
Description Tags on Your Website
Advanced Techniques for SEO
SEO and HTML
Seo friends
SEO Content
HTML Tags
Web Position
HTML Intro
seo strategies
HTML Extension
Content Will Still Reign as King
HTML Examples
Best SEO Tips And Tricks
HTML Headings
5 ways to help seo
HTML Paragraph
http://seo-tips-tech.blogspot.com/2012/07/element.html
Best Marketing SEO
XML and HTML sitemap
SEO Tips for Google
keywords on one page

Make import contacts to whatsapp iphone


Open your bluestuck then download astro
 file manager after installing click connect
 and you can add your social account if you
want login to box enter email add ,confirmation
of your email then password after that wait until
 succesfully login put contact list under this
folder c:programDataBlueStacksUserData|SharedFolder
 make sure to show hidden files now to go go to astro
 app that you have install right now and look for the
folder sdcard/bstfolder/bstSharedFolder click on its
 directly add to your bluestack contact list now check
 your whatapp contact list you will find it updated.


With Nokia PC Suite you can export your
 contacst to CSV file make sure to sync
 first, and export contacts from both SIM
 card and phone memory. Then you can import
 CSV file where you want. You can import CSV
 file into iPhone contacts directly from CSV
file with app Contacts In: Import CSV & Manage Groups.

Capture Video of Android's Screen


Android 4.4 KitKat has a shell utility for recording
the Android device screen. Connect a device in
developer/debug mode running KitKat with the
 adb utility over USB and then type the following:

adb shell screenrecord /sdcard/movie.mp4
Press Ctrl-C to stop
adb pull /sdcard/movie.mp4

Screen recording is limited to a maximum of 5 minutes.
use a screen recorder, such as SMRecorder.
Instead of using the emulator, which is slow -
especially for games and things you would want a
video of, I recommend using a VirtualBox VM,
with Android installed. You can connect the
Dalvik debugger to it and debug you app there.
If the debugger slows down you app too much,
 disconnect it to record the video. There are many links
out there explaining how to set up the Android VM for debugging.

To make the Android phone screen video capture easy, 
you can try Wondershare MobileGo for Windows users or
 Wondershare MobileGo for Android Pro Mac for Mac users. 
The software is mainly designed for manage data on your 
Android phone or tablet from Windows PC or Mac. Besides,
 both versions let you capture videos, game screenshot on 
your Android phone with 1 click.

Jason Statham - Hollywood movies, adventure film

action movies - Jason Statham - Hollywood movies, adventure film