Posts

MOST IMPORTANT QUESTIONS GENERALLY USED TO BE ASKED IN THE INTERVIEW ON STRING FUNCTIONS IN PHP

  MOST IMPORTANT QUESTIONS GENERALLY USED TO BE ASKED IN THE INTERVIEW ON STRING FUNCTIONS IN PHP Q1. What is string() function? Ans: string() function is the manipulation of string. Q2. What is meant by ucfirst() function? Explain with an example. Ans: ucfirst() function is the upper case of the first word in a string. CODE => <?php $str="i am going to school"; $ucfirst=ucfirst($str); echo "$ucfirst"; ?> OUTPUT => I am going to school Q3. What is meant by lcfirst() function? Explain with an example. Ans: lcfirst() function is the lowercase of the first word in a string. CODE => <?php $str="Welcome to our school"; $lcfirst=lcfirst($str); echo "$lcfirst"; ?> OUTPUT => welcome to our school Q4.  What is meant by ucwords() function? Explain with an example.   Ans: ucwords() function is to provide uppercase to all words in a string. CODE => <?php $str="hello welcome to our cricket academy"; $ucwords=ucwords($st...

MOST IMPORTANT QUESTIONS GENERALLY USED TO BE ASKED IN THE INTERVIEW ON ARRAY FUNCTIONS IN PHP

  MOST IMPORTANT QUESTIONS GENERALLY USED TO BE ASKED IN THE INTERVIEW ON ARRAY FUNCTIONS IN PHP Q1. What is Array Function()? Ans: Array Function() can manipulate the array elements. Q2. What is array_pop()? Explain with an example.  Ans: array_pop() is a manipulation function that removes the last element of an array. CODE => <?php $arr=["10","20","30"]; $arrpop=array_pop($arr); print_r($arr); ?> OUTPUT => Array ( [0] => 10 [1] => 20 ) Q3. What is array_push()?  Explain with an example. Ans: array_push() can insert the element at the end of the array.  CODE => <?php $arr=["Tiger","Lion"]; $arrpush=array_push($arr, "Hyena"); print_r($arr); ?> OUTPUT => Array ( [0] => Tiger [1] => Lion [2] => Hyena ) Q4. What is meant by array_shift()?  Explain with an example. Ans: array_shift() removes the first element of an array. CODE =>  <?php $arr=["Amit","Sanchari","...

MOST IMPORTANT QUESTIONS GENERALLY USED TO BE ASKED IN THE INTERVIEW ON SESSION AND COOKIES OF PHP

MOST IMPORTANT QUESTIONS GENERALLY USED TO BE ASKED IN THE INTERVIEW ON SESSION AND COOKIES OF PHP Q1. What is the difference between GET() and POST() method? Ans: GET() Method = > GET() Method is the less secure method. GET() Method can pass the query string. POST() Method => POST() Method is the most secure method. POST() Method cannot pass the query string. Q2. Explain the function of cookies? Ans: The function of cookies is to hold the data of the users. Q3. What do you mean by Cookie? Ans: Cookie is a small file sent by the server to the client machine to trace how long ago the user has visited the website. Cookie is used to store the user information on the client machine. Cookie in PHP has a super global variable $_COOKIE. Real Life Example => Remember Me. Q4. Why Cookie is known as Global Carrier of data? Ans: Scope of Cookie is set to application layer. If we create Cookie in one page, we can reuse it's value to all other pages of the same application. That is why...

MY OWN EXPLANATION OF THE CONCEPTS OF ARRAY_MERGE() FUNCTION AND ARRAY_COMBINE() FUNCTION ALONG WITH ONE EXAMPLE "TAKE 4 ARRAYS THEN MERGE THE ARRAYS USING ARRAY_COMBINE() FUNCTION" USING BOOTSTRAP-5 CLASSES IN HTML AND PHP (COMMONLY USED IN CRUD OPERATION WHILE WORKING IN LIVE PROJECTS IN INDUSTRY AS A PHP WEB DEVELOPER)

Image
 MY OWN EXPLANATION OF THE CONCEPTS OF ARRAY_MERGE() FUNCTION AND ARRAY_COMBINE() FUNCTION ALONG WITH ONE EXAMPLE "TAKE 4 ARRAYS THEN MERGE THE ARRAYS USING ARRAY_COMBINE() FUNCTION" USING BOOTSTRAP-5 CLASSES IN HTML AND PHP (COMMONLY USED IN CRUD OPERATION WHILE WORKING IN LIVE PROJECTS IN INDUSTRY AS A PHP WEB DEVELOPER) Hi Guys, Very good evening to all of you. So, today I am going to explain about the comcepts of array_merge() and array_combine() function using one example and also I am going to explain about the Bootstrap-5 classes which I have used in my example of array_merge() and array_combine() function.           So, without wasting any more time let's begin with the explanation.             Firstly, I am explaining about the concept of array_combine() function. So, array_combine() function is the function which can merge two arrays into one array. And array_combine() function should be of same size or same valu...

Programmings Based On Array And String Functions To Merge The 2 Arrays, Then After Merge Convert Into String And Then Find Out The 1st And Last Word From The Reverse String

Image
  Programmings Based On Array And String Functions To Merge The 2 Arrays, Then After Merge Convert Into String And Then Find Out The 1st And Last Word From The Reverse String Q1. Take 2 arrays then margin the arrays. After margin convert into string then reverse the string and find out 1st and last word from the reverse string. Ans: Coding => <?php $arr1 =[ "Dhoni" , "Rohit" , "Kohli" , "Rahul" ]; $arr2 =[ "Bumrah" , "Shami" , "Siraj" , "Chahal" ]; $arrmer = array_merge ( $arr1 , $arr2 ); print_r ( $arrmer ); echo "<br>" ; $str = implode ( " " , $arrmer ); print_r ( $str ); echo "<br>" ; $strrev = strrev ( $str ); print_r ( $strrev ); echo "<br>" ; $arr = explode ( " " , $strrev ); print_r ( $arr ); echo "<br>" ; $firstword = array_shift ( $arr ); $lastword = array_pop ( $arr ); print_r ( $firstword ); echo "...

Programmings Based On Array And String Functions To Find How Many Numbers Of Positive, Negative And Zero Numbers Present In The Array $arr=array(-1,-2,-3,-4,0,0,1,2,3,4)

Image
Programmings Based On Array And String Functions To Find How Many Numbers Of Positive, Negative And Zero Numbers Present In The Array $arr=array(-1,-2,-3,-4,0,0,1,2,3,4) Q1. Find how many numbers of Positive, Negative, 0 numbers present in this array. $arr=array(-1,-2,-3,-4,0,0,1,2,3,4) Ans: Coding => <?php $arr = array (- 1 ,- 2 ,- 3 ,- 4 , 0 , 0 , 1 , 2 , 3 , 4 ); $pn = 0 ; $nn = 0 ; $zn = 0 ; $len = count ( $arr ); for ( $i = 0 ; $i < $len ; $i ++) {     if ( $arr [ $i ]> 0 ) {         $pn ++;     }     else if ( $arr [ $i ]< 0 ) {         $nn ++;     }     else {         $zn ++;     } } echo "The positive number present in the array is: " . $pn . "<br>" ; echo "The negative number present in the array is: " . $nn . "<br>" ; echo "The zero number present in the array is: " . $zn ; ? > Output Of The Coding => Explanation Of Th...

Programmings Based On Array And String Functions Including Printing The Array Using Echo, Finding Out The 1st And Last Word In A Sentence, Finding Out The 1st Alphabet From A String And Also To Check Whether My Variable Is In Form Of Array Or Not

Image
Programmings Based On Array And String Functions Including Printing The Array Using Echo Where We Cannot Concatenate The Index Number, Finding Out The 1st And Last Word In A Sentence, Finding Out The 1st Alphabet From A String And Also To Check Whether My Variable Is In Form Of Array Or Not Q1. Print the array using echo where ou cannot concatinate the index number. Ans: Coding Example No. - 01 => <?php $arr =[ "500" , "1000" , "1500" , "2000" ]; $len = count ( $arr ); for ( $i = 0 ; $i < $len ; $i ++) {     echo " $arr [ $i ]" ; } ? > <?php $arr =[ "500" , "1000" , "1500" , "2000" ]; $len = count ( $arr ); for ( $i = 0 ; $i < $len ; $i ++) {     echo " $arr [ $i ]" . "<br>" ; } ? > Output Of The Coding Example No. - 01 => Coding Example No. - 02 => <?php $arrayName = array ( '100' , '200' , '300' , '400...