We are helping to solve Php Java Android SQL Java Script .............

Saturday 12 November 2016

Interviews Php Java Android Java Script SQL HTML

Job interviewing never seems to get any easier - even when you have gone on more interviews than you can count. You are always meeting new people, having to sell yourself and your skills, and often getting the third degree about what you know or don't know. And, you have to stay upbeat and enthusiastic throughout each interview.

That said, there are ways to make a job interview much less stressful.

                      PHP interview questions and answers


Question: What are the different types of errors in php?
Answer:
E_ERROR: A fatal error that causes script termination
E_WARNING: Run-time warning that does not cause script termination
E_ALL: Catches all errors and warnings
E_PARSE: Compile time parse error.
E_NOTICE: Run time notice caused due to error in code
E_USER_WARNING: User-generated warning message.
E_USER_ERROR: User-generated error message.
E_USER_NOTICE: User-generated notice message.
E_STRICT: Run-time notices.
E_RECOVERABLE_ERROR: Catchable fatal error indicating a dangerous error

Question: What is maximum size of a database in mysql?
Answer: Depend on Operating System

Question: What is meant by MIME?
Answer:
Multipurpose Internet Mail Extensions. 

WWW ability to recognize and handle files of different types is largely dependent on the use of the MIME (Multipurpose Internet Mail Extensions) standard. The standard provides for a system of registration of file types with information about the applications needed to process them. 

Question: What Is a Persistent Cookie?
Answer:

Persistent cookie is a cookie which is permanently stored on user’s computer in a cookie file. They are used for tracking the user information of the users who are browsing from a very long time. They also have the drawbacks of being unsecure, as user can see the cookies which are saved on the computer. 

Question: How to set persistent Cookie?
There is no special way to set persistent cookies. Setting Cookies with an expiration date become persistent cookie.

setcookie( "cookieName", 'cookieValue', strtotime( '+30 days' ) );

Question: How can PHP read the hash portion of the URL?
Answer: PHP can't read the hash portion of the URL
index.php?page=group#birthday
Here, PHP can not read the birthday

Question: What Is difference between array_combine and array_merge?
Answer:
array_combine give an array by combining two arrays($keyArray, $valueArray) and both $keyArray & $valueArray must have same number of elements. $keyArrays become keys of returning Array, $valueArray become values of returning Arrays.

array_merge gives an array by merging two array ($array1, $array2) and both can have different number of elements. $array1 and $array2 are added in returning array.

Question: What Is difference between Cookie and Session?
Answer:
Cookie are stored in client side (e.g Browser) where as Session are stored in server side (tmp file of web server). Cookie can be added/update/delete from browser but session can't delete from browser. 
Session is depended on cookie. For example: When user login in website then session is created in webserver. To communicate the webserver with user, an cookie is created by the application. with use of this cookie-key, Server get to know that user is login OR not.

Question: What are encryption functions in PHP? 
CRYPT(), MD5() 

Question: How to store the uploaded file to the final location? move_uploaded_file( string filename, string destination)

Question: Explain mysql_error(). The mysql_error() message will tell us what was wrong with our mysql query.


@@@@@@
Question: How to add element to array?
$arrayData = array(0=>'one',1=>'two',3=>'three'); 
print_r($arrayData);
/*
 Array ( [0] => one [1] => two [3] => three ) 
 */
$arrayData['4']='four';


print_r($arrayData);
/**
Array ( [0] => one [1] => two [3] => three [4] => four ) 
 * 
 */
Question: How to add multiple element in array?
$arrayData = array(0=>'one',1=>'two',3=>'three'); 
print_r($arrayData);
/*
 Array ( [0] => one [1] => two [3] => three ) 
 */
$arrayData['4']='four';
$arrayData['5']='five';


print_r($arrayData);
/**
Array ( [0] => one [1] => two [3] => three [4] => four [5] => five ) 
 * 
 */
Question: How to replace multiple array element with single array?
$arrayData = array(0=>'one',1=>'two',3=>'three',4=>'four',5=>'five',6=>'six'); 
print_r($arrayData); echo "
";
/*
 * Array ( [0] => one [1] => two [3] => three [4] => four [5] => five [6] => six ) 
 */
array_splice($arrayData, 1,2,array('r'=>'replaced'));


print_r($arrayData);
/**
Array ( [0] => one [1] => replaced [2] => four [3] => five [4] => six ) 
 * 
 */
Question: How to add element to an begining of array?
$arrayData = array(0=>'one',1=>'two',3=>'three'); 
print_r($arrayData);
/*
Array ( [0] => one [1] => two [3] => three )  
 */
array_unshift($arrayData, "four", "five");


print_r($arrayData);
/**
Array ( [0] => four [1] => five [2] => one [3] => two [4] => three ) 
 * 
 */
Question: How to add elements at the end of array?
$arrayData = array(0=>'one',1=>'two',3=>'three'); 
print_r($arrayData);
/*
Array ( [0] => one [1] => two [3] => three )  
 */
array_push($arrayData, "four", "five");


print_r($arrayData);
/**
Array ( [0] => four [1] => five [2] => one [3] => two [4] => three ) 
 * 
 */
Question: How to create Model Object?
$userObj= D("Common/Users");
Question: How to add simple AND Query?
$map=array();
$userObj= D("Common/Users");
$map['user_type'] = 2;
$map['city_id'] = 10;
 $lists = $userObj
                ->alias("u")                
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to add simple OR Query?
$map=array();
$userObj= D("Common/Users");
$map['u.username|u.email'] = 'email@domain.com';  //username OR email is email@domain.com
 $lists = $userObj
                ->alias("u")                
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use =, >, < in Query?
$map['id']  = array('eq',1000); //equal to 1000

$map['id']  = array('neq',1000); //Not equal to 1000

$map['id']  = array('gt',1000);//Greater than 1000

$map['id']  = array('egt',1000);//Greater than OR EQual 1000

$map['id']  = array('between','1,8'); //Between 1-8
Question: How to use like Query?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u")                
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use like Query with NOT?
$map=array();
$userObj= D("Common/Users");
$map['b'] =array('notlike',array('%test%','%tp'),'AND'); //Not like %test% and %tp
 $lists = $userObj
                ->alias("u")                
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use Inner JOIN ?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u") 
                ->join(C('DB_PREFIX') . "profile as p ON u.id = p.uid")               
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use LEFT JOIN ?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u") 
                ->join('LEFT JOIN '.C('DB_PREFIX') . "profile as p ON u.id = p.uid")               
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use RIGHT JOIN ?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u") 
                ->join('RIGHT JOIN '.C('DB_PREFIX') . "profile as p ON u.id = p.uid")               
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use group by and having?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u") 
                ->join('RIGHT JOIN '.C('DB_PREFIX') . "profile as p ON u.id = p.uid")               
                ->where($map)
                ->order("u.id DESC")
                 ->group('u.id')                
                 ->having('count(p.id) >0')
                ->select();
Question: How to use count(for total records)?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $count = $userObj
                ->alias("u")                 
                ->where($map)                
                ->count();

Share:

0 comments:

Contact Form

Name

Email *

Message *

Supersoftitsolutions.com - Software Development Company