Get Website Lowest price!

Wordpress Experts!


php up to date

PHP Question And Answers

PHP Question And Answers

1. What is the importance of "action" attribute in a html form?
ANS: The action attribute determines where to send the form-data in the form submission.

2. Distinguish between urlencode and urldecode?
ANS: This method is best when encode a string to used in a query part of a url. it returns a string in which all non-alphanumeric characters except -_. have replece with a percentege(%) sign . the urldecode->Decodes url to encode string as any %and other symbole are decode by the use of the urldecode() function.

3. what is sql injection ?
ANS: SQL injection is a malicious code injection technique.It exploiting SQL vulnerabilities in Web applications

4. What is the difference between $var and $$var?
ANS: They are both variables. But $var is a variable with a fixed name. $$var is a variable who's name is stored in $var. For example, if $var contains "message", $$var is the same as $message.
  $var is a variable and $$var is a variable of another variable. For example

$var = "YOU";
$you= "Me";

echo $var //Output:- you
echo $$var //output :-Me

$$var allows the developer to change the name of the variable dynamically.

5. Explain how to submit form without a submit button.
ANS: A form data can be posted or submitted without the button in the following ways:

1. On OnClick event of a label in the form, a JavaScript function can be called to submit the form e.g. document.form_name.submit()

2. Using a Hyperlink: On clicking the link, JavaScript function can be called e.g <a.href=” javascript:document.MyForm.submit();">

6. What is Joomla in PHP?
ANS: Joomla is an open source content management system. Joomla can be used in PHP as a framework to publish web contents. Joomla allows the user to manage the content of the web pages with ease.

7. What is difference between developing website using Java and PHP?
ANS: In order to make interactive pages, java uses JSP (Java Server pages). PHP is open source while JSP is not. Libraries are much stronger in Java as compared tp PHP. Huge codes can be managed with ease in Java by making classes.   

8. How can I embed a java programme in php file?
ANS: PHP can be integrated into the servlet environment of java or java support can be integrated with php.the java extension can be used to create and invoke methods on Java objects from PHP.

9. How to get jQuery nth Element?
ANS: //include jQuery file
<script type="text/javascript" src="jquery.js"></script>
function go_to(id_number){     
     var obj=jQuery('div.mydiv ul li:nth-child('+id_number+') a');      

10.What is Invoking Client Programs?
ANS: MySQL client programs can be invoked from the command line. For example from a Windows console prompt OR a Unix shell prompt.
EX: shell> mysql -h localhost -p -u myname

11.What is needed to be able to use image function?
ANS: GD library is needed to be able execute image functions.
12. What is the use of the function ‘imagetypes()’?
ANS: imagetypes() gives the image format and types supported by the current version of GD-PHP.
13. What are the functions to be used to get the image’s properties (size, width and height)?
ANS: The functions are getimagesize() for size, imagesx() for width and imagesy() for height.
14. How failures in execution are handled with include() and require() functions?
ANS: If the function require() cannot access to the file then it ends with a fatal error. However, the include() function gives a warning and the PHP script continues to execute.
15. What is the main difference between require() and require_once()?
ANS: require() and require_once() perform the same task except that the second function checks if the PHP script is already included or not before executing it.
(same for include_once() and include())
16. How can we automatically escape incoming data? 
ANS: We have to enable the Magic quotes entry in the configuration file of PHP.
17. How can you pass a variable by reference?
To be able to pass a variable by reference, we use an ampersand in front of it, as follows $var1 = &$var2



  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment


Post a Comment