31. How can we get second of the current time using date function?
$second = date("s");
32. How can we convert the time zones using php?
33. What is meant by urlencode and urldocode?
urlencode() returns the URL encoded version of the given string. URL coding converts special characters into % signs followed by two hex digits. For example: urlencode("10.00%") will return "10%2E00%25?. URL encoded strings are safe to be used as part of URLs.
urldecode() returns the URL decoded version of the given string.
34. What is the difference between the functions unlink and unset?
unlink() deletes the given file from the file system.
unset() makes a variable undefined.
35. How can we register the variables into a session?
We can use the session_register ($ur_session_var) function.
36. How can we get the properties (size, type, width, height) of an image using php image functions?
To know the Image type use exif_imagetype () function
To know the Image size use getimagesize () function
To know the image width use imagesx () function
To know the image height use imagesy() function
37. How can we get the browser properties using php?
38. What is the maximum size of a file that can be uploaded using php and how can we change this?
You can change maximum size of a file set upload_max_filesize variable in php.ini file
39. How can we increase the execution time of a php script?
Set max_execution_time variable in php.ini file to your desired time in second.
40. How can we take a backup of a mysql table and how can we restore it.?
Answer: Create a full backup of your database: shell> mysqldump –tab=/path/to/some/dir –opt db_name Or: shell> mysqlhotcopy db_name /path/to/some/dir
The full backup file is just a set of SQL statements, so restoring it is very easy:
shell> mysql "."Executed";
mysql_close($link2);
41. How can we optimize or increase the speed of a mysql select query?
42. How many ways can we get the value of current session id?
ans:-
session_id() returns the session id for the current session.
43. How can we destroy the session, how can we unset the variable of a session?
Ans:-
session_unregister — Unregister a global variable from the current session
session_unset — Free all session variables
44. How can we destroy the cookie?
Ans:-
Set the cookie in past
45. How many ways we can pass the variable through the navigation between the pages?
Ans:-
GET or QueryString and POST
46. What is the difference between ereg_replace() and eregi_replace()?
Ans:-
eregi_replace() function is identical to ereg_replace() except that this ignores case distinction when matching alphabetic characters.eregi_replace() function is identical to ereg_replace() except that this ignores case distinction when matching alphabetic characters.
47. What are the different functions in sorting an array?
Ans:-
Sorting functions in PHP,
asort-http://www.php.net/manual/en/function.asort.php
arsort-http://www.php.net/manual/en/function.arsort.php
ksort-http://www.php.net/manual/en/function.ksort.php
krsort-http://www.php.net/manual/en/function.krsort.php
uksort-http://www.php.net/manual/en/function.uksort.php
sort-http://www.php.net/manual/en/function.sort.php
natsort-http://www.php.net/manual/en/function.natsort.php
rsort-http://www.php.net/manual/en/function.rsort.php
48. How can we know the count/number of elements of an array?
Ans:-
2 ways
a) sizeof($urarray) This function is an alias of count()
b) count($urarray)
interestingly if u just pass a simple var instead of a an array it will return 1.
49. What is the PHP predefined variable that tells the What types of images that PHP supports?
50. How can I know that a variable is a number or not using a JavaScript?
51. List out some tools through which we can draw E-R diagrams for mysql.
52. How can I retrieve values from one database server and store them in other database server using PHP?
53. List out the predefined classes in php?
Directory
stdClass
__PHP_Incomplete_Class
exception
php_user_filter
54. How can I make a script that can be bilanguage (supports Eglish, German)?
You can change charset variable in above line in the script to support bilanguage.
55. What are the difference between abstract class and interface?
Abstract class: abstract classes are the class where one or more methods are abstract but not necessarily all method has to be abstract. Abstract methods are the methods, which are declare in its class but not define. The definition of those methods must be in its extending class.
Interface: Interfaces are one type of class where all the methods are abstract. That means all the methods only declared but not defined. All the methods must be define by its implemented class.
56. How can we send mail-using JavaScript?
NO! JavaScript can't email a form! but, there are alternatives to send the form data to an email address.
57. How can we repair a mysql table?
The syntex for repairing a mysql table is
REPAIR TABLENAME, [TABLENAME, ], [Quick],[Extended]
This command will repair the table specified if the quick is given the mysql will do a repair of only the index tree if the extended is given it will create index row by row
58. What are the advantages of stored procedures, triggers, indexes?
A stored procedure is a set of SQL commands that can be compiled and stored in the server. Once this has been done, clients don't need to keep re-issuing the entire query but can refer to the stored procedure. This provides better overall performance because the query has to be parsed only once, and less information needs to be sent between the server and the client. You can also raise the conceptual level by having libraries of functions in the server. However, stored procedures of course do increase the load on the database server system, as more of the work is done on the server side and less on the client (application) side.
Triggers will also be implemented. A trigger is effectively a type of stored procedure, one that is invoked when a particular event occurs. For example, you can install a stored procedure that is triggered each time a record is deleted from a transaction table and that stored procedure automatically deletes the corresponding customer from a customer table when all his transactions are deleted.
Indexes are used to find rows with specific column values quickly. Without an index, MySQL must begin with the first row and then read through the entire table to find the relevant rows. The larger the table, the more this costs. If the table has an index for the columns in question, MySQL can quickly determine the position to seek to in the middle of the data file without having to look at all the data. If a table has 1,000 rows, this is at least 100 times faster than reading sequentially. If you need to access most of the rows, it is faster to read sequentially, because this minimizes disk seeks.
59. What is the maximum length of a table name, database name, and fieldname in mysql?
Database name- 64
Table name -64
Fieldname-64
60. How many values can the SET function of mysql takes?
Mysql set can take zero or more values but at the maximum it can take 64 values
No comments:
Post a Comment