PHP WEB DEVELOPMENT PART - 3 PROBABLE MOST IMPORTANT INTERVIEW QUESTIONS AND ANSWERS MADE BY ME GENERALLY ASKED IN PITANGENT ANALYTICS AND TECHNOLOGY SOLUTIONS PVT. LTD. FOR FRESHERS

PHP WEB DEVELOPMENT PART - 3 PROBABLE MOST IMPORTANT INTERVIEW QUESTIONS AND ANSWERS MADE BY ME GENERALLY ASKED IN PITANGENT ANALYTICS AND TECHNOLOGY SOLUTIONS PVT. LTD. FOR FRESHERS

Q13. Write a program to check if a string is a palindrome.

Ans: 

<?php
$str="noon";
$str=strtolower($str);
$str2=strtolower(strrev($str));
if($str==$str2){
    echo "The string $str is a palindrome";
}
else{
    echo "The string $str is not a palindrome";
}
?>

Output =>

Q2. How to find duplicate rows in a table?

Ans: To find duplicate rows in a table I need to use GROUP BY and HAVING clauses.

SELECT column1, column2,..., COUNT(*)

FROM table_name

GROUP BY column1,column2,...

HAVING COUNT(*) > 1;

Q3. Write a program to count the number of vowels in a string.

Ans: 

<?php
$str="I love playing cricket";
$vow=0;
$str=str_replace(" ","",$str);
$length=strlen($str);
for($i=0;$i<$length;$i++){
    if($str[$i] == "A" || $str[$i] == "E" || $str[$i] == "I" || $str[$i] == "O" || $str[$i] == "U" || $str[$i] == "a" || $str[$i] == "e" || $str[$i] == "i" || $str[$i] == "o" || $str[$i] == "u"){
        $vow++;
    }
}
print_r("The number of vowels in a string is: ".$vow);
?> 


Output =>




 

Comments

Popular posts from this blog

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

PHP WEB DEVELOPMENT INTERVIEW QUESTIONS ASKED IN APOLLO HOSPITAL ALONG WITH MY OWN CONCEPTS AND MY OWN EXPLANATION ANSWERS(PART - 1) REST OF THE QUESTIONS AND ANSWERS WILL BE PREPARED BY ME IN MY NEXT BLOG

Mini Project On Multi User CRUD Operations(Create, Read, Update & Delete) Of Donar Details Of Indian Nationals Who Donate To Ramkrishna Math, Belur Math Using PDO (PHP Data Objects) With Proper Explanation Of Each And Every Individual Line Of The Code Of connection.php Page, form.php Page, formaction.php Page, admin_display.php Page, client_display.php Page, edit.php Page, editaction.php Page And delet.php Page (Here You Will Find The Image Of Sayang Sri Ramkrishna Dev, Sayang Sri Ma Sarada Devi & Sayang Sri Swami Vivekananda) In My CRUD Operation