PHP interview questions and answers (PHP साक्षात्कार प्रश्न और उत्तर) –
Question 1. How many types of arrays supported by PHP language (PHP भाषा कितने प्रकार के arrays का समर्थन करती है?) ?
Answer : There are 3 main types of arrays supported in PHP.
- Indexed arrays: Indexed arrays contain numerical for for indexing elements.
- Associative arrays: Associative arrays contain strings for indexing elements.
- Multidimensional arrays: These are arrays that contain more than one index and dimension (बहुआयामी सरणियाँ: ये ऐसी सरणियाँ हैं जिनमें एक से अधिक सूचकांक और आयाम होते हैं।).
Question 2. What are the various constants predefined in PHP script (PHP में पूर्वनिर्धारित विभिन्न स्थिरांक क्या हैं?) ?
Answer : PHP consists of many constants, some of the more widely used as follows (PHP में कई स्थिरांक होते हैं, जिनमें से कुछ अधिक व्यापक रूप से इस प्रकार उपयोग किए जाते हैं ) –
- __FILE__: It denotes path and the file name
- __METHOD__: Represents the class name
- __FUNCTION__: Denotes the function name
- __CLASS__: Returns the class name
Question 3. What is different between an indexed array & an associative array in PHP (PHP में अनुक्रमित सरणी और एसोसिएटिव सरणी के बीच क्या अंतर है?)?
Answer : Indexed array is an array with a numeric key. The keys of an indexed array start at 0..
Associative arrays have strings as keys.
- Example –
<?php
// Declaring an indexed array
$arr = array(9, 7, 30, 40, 56);
Output -
Array : Array
(
[0] => 9
[1] => 7
[2] => 30
[3] => 40
[4] => 56
)
// Declaring an associative array
$arr = array(
"name" => "Ashok",
"age" => "30",
"mobileNo" => "1234567890"
);
Output -
Array : Array
(
[name] => Ashok
[age] => 30
[mobileNo] => 1234567890
)
?>Question 4. What are sessions and cookies in PHP (PHP में सत्र और कुकीज़ क्या हैं?)?
Answer : Sessions are global variables that are stored on the server side. In PHP, always initialize sessions using session_start().
PHP Cookies are also variables but it stored on the client’s web browser.A PHP cookie can be set using setcookie() function (PHP कुकीज़ भी चर हैं लेकिन यह क्लाइंट के वेब ब्राउज़र पर संग्रहीत हैं। PHP कुकी को setcookie() फ़ंक्शन का उपयोग करके सेट किया जा सकता है।).
Question 5. How does define constant in PHP script language (PHP स्क्रिप्ट भाषा में स्थिरांक को कैसे परिभाषित किया जाता है?)?
Answer : PHP Constants can be defined by making use of the define() function. It can not changes after defined. They do not need to be starting with $ sign.
Top 50 PHP Interview Questions and Answers…
PHP interview questions and answers
Tags: How many types of arrays supported by PHP, interview questions & answers PHP, PHP interview questions & answers, PHP interview questions & answers for freshers, Top 20 PHP interview questions

best question
Best Interview qes and Ans