The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we help you to solve your academic and programming questions fast.
In eduladder you can Ask,Answer,Listen,Earn and Download Questions and Question papers.
Watch related videos of your favorite subject.
Connect with students from different parts of the world.
Apply or Post Jobs, Courses ,Internships and Volunteering opportunity. For FREE
See Our team
Wondering how we keep quality?
Got unsolved questions? Ask Questions

Every-day-code-->View question

Write a PHP function that checks whether a passed string is a palindrome or not?

A palindrome is a word, phrase, or sequence that reads the same backward as forward, e.g., madam or nurses run.



Here is the php fiddle 
You can edit your code here :

//phpfiddle.org/lite?code=<?php\n\n\n?>\n


Asked On2019-06-27 05:30:51 by:Jaynil-Gaglani

Taged users:


Likes:
Be first to like this question

Dislikes:
Be first to dislike this question
Talk about this  Like  Dislike
View all qusetions
Answers
Here is a PHP function that checks whether a passed string is a palindrome or not:

<?php 
// PHP code to check for Palindrome string in PHP 
// Using strrev() 

function Palindrome($string){   

    if (strrev($string) == $string){   

        return 1;   

    } 

    else{ 

        return 0; 

    } 
}   

  
// Driver Code 

$original = "DAD";  

if(Palindrome($original)){   

    echo "Palindrome";   
}  

else {   

echo "Not a Palindrome";   
?>   

Answerd on:2019-06-27 Answerd By:KAPILJHADE

Likes:
|KAPILJHADE

Dislikes:
Be first to dislike this answer
Talk about this  Like  Dislike

You might like this video:Watch more here

Watch more videos from this user Here

Learn how to upload a video and start earning here

Palindrome Number
A palindrome number is a number which remains same when its digits are reversed.

For example, number 24142 is a palindrome number. On reversing it we?ll get the same number.

Logic:

Take a number.
Reverse the input number.
Compare the two numbers.
If equal, it means number is palindrome
Palindrome Number in PHP


<?php  
function palindrome($n){  
$number = $n;  
$sum = 0;  
while(floor($number)) {  
$rem = $number % 10;  
$sum = $sum * 10 + $rem;  
$number = $number/10;  
}  
return $sum;  
}  
$input = 1235321;  
$num = palindrome($input);  
if($input==$num){  
echo "$input is a Palindrome number";  
} else {  
echo "$input is not a Palindrome";  
}  
?>  

Answerd on:2019-06-27 Answerd By:avi738

Likes:
Be first to like this answer

Dislikes:
Be first to dislike this answer
Talk about this  Like  Dislike

You might like this video:Watch more here

Watch more videos from this user Here

Learn how to upload a video and start earning here

solution to the code challenge

//phpfiddle.org/lite?code=<?php\nfunction Palindrome($string){\n if (strrev($string) == $string){\n return 1;\n }\n else{\n return 0;\n }\n}\n\n\n$original = "MALAYALAM";\nif(Palindrome($original)){\n echo "Palindrome";\n}\nelse {\necho "Not a Palindrome";\n}\n\n?>\n


Answerd on:2019-06-27 Answerd By:Gaganpreet-Gandhi

Likes:
Be first to like this answer

Dislikes:
Be first to dislike this answer
Talk about this  Like  Dislike

You might like this video:Watch more here

Watch more videos from this user Here

Learn how to upload a video and start earning here



Lets together make the web is a better place

We made eduladder by keeping the ideology of building a supermarket of all the educational material available under one roof. We are doing it with the help of individual contributors like you, interns and employees. So the resources you are looking for can be easily available and accessible also with the freedom of remix reuse and reshare our content under the terms of creative commons license with attribution required close.

You can also contribute to our vision of "Helping student to pass any exams" with these.
Answer a question: You can answer the questions not yet answered in eduladder.How to answer a question
Career: Work or do your internship with us.Work with us
Create a video: You can teach anything and everything each video should be less than five minutes should cover the idea less than five min.How to upload a video on eduladder