Q. Tell something about PHP.
Ans. PHP stands for: Hypertext
Preprocessor. PHP is a server side scripting language which is used to develop
the dynamic websites.
Q. What is MVC?
Ans. MVC stands for Model, View, and
Controller. PHP MVC is an effective way to manage the code into 3 different
layers.
Model: Model represents the
information in application.
View: View represents the visual
representation of information and data that you have entered in the
application.
Controller: Controller is actually how and
in which way you want to read the information in application.
Q. What are the different types of CSS you can add in a page?
Ans. There are three types of CSS
that can be added in a page.
- External CSS.
- Internal CSS.
- Inline CSS.
Q. Does PHP support multiple inheritances?
Ans. No, PHP support only single
level of inheritance. A class can be inherited from a single class using
keyword ‘extended’.
Q. What is the difference between echo and print?
Ans.. Initially both look same because
both used to display any value. Main difference between echo and print is that
echo is just used to display any string in output. It will display whatever is
passed to it but on other hand print is a function itself it not only display
any value but also can return value.
Q. What is the difference between GET and POST method?
Ans. Whenever we fill any form on
internet we can used one from two methods to send data on sever computer, that
method can be either GET or POST. When we use the GET method all information is
displayed on address bar. If can sent up to 1024 of data using GET method so it
is good to use only when we are working with small scale applications and data
is not that much sensitive. If we talk about POST method, No information will
be displayed on address bar and we can send up to 2 mb of data using POST
method. This limit can also extend further if required. PHP includes many CMS
systems which can be used to handle the web content in a effective way.
Q.What functions are used to get the image size, Width and Height?
Ans. getimagesize () to get the size
of an image
Imagesx () to get width of an image
Imagesy () to get height of an image.
Q. What is PEAR in PHP?
Ans. PEAR stands for “PHP Extension and Application Repository”. PEAR
provides an inbuilt library of open source code for PHP developers. It provides
support for package maintains and code distribution.
Q. How do you upload videos using PHP & MySQL?
Ans. We just need to copy the path
of stored videos in the database rather than storing the videos files itself.
All videos will be saved on a different folder and videos can be called from
that folder when ever required. Default size is 2 mb for video files but we can
change that size from max_file size option in php.ini file.
Q. What are the different types of errors in PHP?
Ans.There are three types of errors
encountered in PHP.
1. Notice: These are very normal and
non-critical errors and they even not displayed to users. For examples
accessing a variable that not existed at all.
2. Warning: These are little bit critical
errors. These results are displayed to users but do not affect the output of
code. For example trying to include any file that is not exists.
3. Fatal errors: These are really critical
errors. For example calling any non existence class.
Q. How constants are defined in a PHP script?
Ans. Define () is used to define
constants in PHP.
define (“Newconstant”, 30);
Q. How can we submit a form without using submit button?
Ans. We can use the hyper links to
submit a form if we don’t want to use submit button. We have to use some java
script code for that.
<a href=”javascript:
document.myform.submit();”>Submit Me
Q. What does a special set of tags do in PHP?
Ans. In PHP special tags the use of this Tags are The output is displayed
directly to the browser. What is meant by nl2br()? Inserts HTML line breaks ( )
before all newlines in a string.
Q. How can we know the total number of elements of Array?
Ans.
- sizeof($array_var)
- count($array_var)
If we just pass a
simple var instead of a an array it will return 1.
Q. How can we set and destroy the cookie in php?
Ans. By using setcookie(name, value, expire, path, domain); function we
can set the cookie in php ;Set the cookies in past for destroy. like
setcookie("user",
"sonia", time()+3600); for set the cookie
setcookie("user",
"", time()-3600); for destroy or delete the cookies;
Q. What is the difference between the functions unlink and unset?
Ans.
- unlink() deletes the given file from the file system.
- unset() makes a variable undefined.
No comments:
Post a Comment