Friday, 6 February 2015

Most Recently PHP and JQuery Interview Questions and Answers

21. How can we Calculate the similarity between two strings. | PHP and jQuery Questions
Using similar_text() get similarity between two strings.
Return Values
Returns the number of matching chars in both strings.
example
<?php
$first =’php3';
$first  =’php4';
echo  retail price similar_text ( $first, $second )  //3
?>

22. Return ASCII value of character in php? | PHP and jQuery Questions
using ord() method we can get ASCII value of character in php.
<?php
$str = "\n" style="color: #007700;">;
if (ord style="color: #0000bb;">$str) == 10) {
echo "The first character of \$str is a line feed.\n";
}
?>

23. How can I execute a PHP script using command line? | PHP and jQuery Questions
Just run the PHP CLI (Command Line Interface) program and provide the PHP script file  name as the command line argument. For example, “php  myScript.php”, assuming “php” is the command to invoke the CLI program. Be aware that if your PHP script was written for the Web CGI interface, it may not execute properly in command line environment.

24. What difference between require() and require_once(). | PHP and jQuery Questions
Require()
The  Require() is  used to include a file, It create fatal  error if file not found and  terminate  script.
require_once()
The require_once() to require() except PHP will check if the file has already been included, and  if so, tricor online not include (require) it again.

25. What does dollar Sign ($) means in JQuery? | PHP and jQuery Questions
Dollar Sign is nothing but it's an alias for JQuery.
Take a look at below jQuery code
$(document).ready(function()
{
}
);
Over here $ sign can be replaced with "jQuery " keyword.
jQuery(document).ready(function(){
});

26. How is body onload() function is different from document.ready() function used in jQuery? | PHP and jQuery Questions
Document.ready() function is different from body onload() function because off 2 reasons.
1. We can have more than one document.ready() function in a page where we can have only one onload function.
2. Document.ready() function is called as soon as DOM is loaded where body.onload() function is called when everything gets loaded on the page that includes DOM, images and all associated resources of the page.

27. What is JQuery UI? | PHP and jQuery Questions
JQuery UI is a library which is built on top of JQuery library. JQuery UI comes with cool widgets, effects and interaction mechanism.

28. Name some of the methods of JQuery used to provide effects? | PHP and jQuery Questions
Some of the common methods are :
1. Show()
2. Hide()
3. Toggle()
4. FadeIn()
5. FadeOut()

29. What are the different type of selectors in Jquery? | PHP and jQuery Questions
There are 3 types of selectors in Jquery
1. CSS Selector
2. XPath Selector
3. Custom Selector

30. How can you select all elements in a page using jQuery? | PHP and jQuery Questions
To select all elements in a page, we can use all selectors, for that we need to use *(asterisk symbol).
<script language="javascript" type="text/javascript">
         $("*").css("border", "2px dotted red");
</script>
More Questions & Answers :-
Page1  Page2  Page3  Part4

No comments:

Post a Comment