PHP Interview Question and answers Part2

Will cover more set of questions clearly here..

All the question and answers listed below are the questions which i faced practically..

Array significant functions reference?

The array() function is used to create an array.

In PHP, there are three types of arrays:

    • Indexed arrays – Arrays with numeric index
    • Associative arrays – Arrays with named keys
    • Multidimensional arrays – Arrays containing one or more arrays


Syntax for indexed arrays:


Syntax for associative arrays:

Parameter Description
key Specifies the key (numeric or string)
value Specifies the value

array() -Create an indexed array named $cars, assign three elements to it, and then print a text containing the array values:

echo “I like ” . $cars[0] . “, ” . $cars[1] . ” and ” . $cars[2] . “.”;

Result: I like Volvo, BMW and Toyota.

array_chunk() – Split an array into chunks of two:


Result: Array ( [0] => Array ( [0] => Volvo [1] => BMW ) [1] => Array ( [0] => Toyota [1] => Honda ) [2] => Array ( [0] => Mercedes [1] => Opel ) )

array_diff() – Compare arrays, and returns the differences (compare values only)



Result: Array ( [d] => yellow )

array_diff_assoc() – Compare arrays, and returns the differences (compare keys and values)



Result: Array ( [d] => yellow )

array_key_exists() – Checks if the specified key exists in the array

if (array_key_exists(“Volvo”,$a))
echo “Key exists!”;
echo “Key does not exist!”;

Result: Key exists!

array_merge() – Merges one or more arrays into one array


Result : Array ( [0] => red [1] => green [2] => blue [3] => yellow )

array_pop() – Deletes the last element of an array


Result: Array ( [0] => red [1] => green )

array_push() – Inserts one or more elements to the end of an array


Result : Array ( [0] => red [1] => green [2] => blue [3] => yellow )

array_rand() -Returns one or more random keys from an array

echo $a[$random_keys[0]].”<br>”;
echo $a[$random_keys[1]].”<br>”;
echo $a[$random_keys[2]];

Result: green

array_search() – Searches an array for a given value and returns the key

echo array_search(“red”,$a);

Result: a

array_sum() – Returns the sum of the values in an array

echo array_sum($a);

Result: 45

array_unique() – Removes duplicate values from an array


Result: Array ( [a] => red [b] => green )

 array_values() – Returns all the values of an array


Result: Array ( [0] => Peter [1] => 41 [2] => USA )


arsort() – Sorts an associative array in descending order, according to the value



Key=Joe, Value=43
Key=Ben, Value=37
Key=Peter, Value=35

asort() – Sorts an associative array in ascending order, according to the value



Key=Peter, Value=35
Key=Ben, Value=37
Key=Joe, Value=43

in_array() – Checks if a specified value exists in an array

$people = array(“Peter”, “Joe”, “Glenn”, “Cleveland”);

if (in_array(“Glenn”, $people))
echo “Match found”;
echo “Match not found”;

Result: Match found


krsort() – Sorts an associative array in descending order, according to the key



Key=Peter, Value=35
Key=Joe, Value=43
Key=Ben, Value=37

ksort() – Sorts an associative array in ascending order, according to the key


foreach($age as $x=>$x_value)
echo “Key=” . $x . “, Value=” . $x_value;
echo “<br>”;


Key=Ben, Value=37
Key=Joe, Value=43
Key=Peter, Value=35

sizeof() – Alias of count()

echo sizeof($cars);

Result: 3

count() – Returns the number of elements in an array

echo count($cars);

Result: 3

String Functions yet to add…
Important String Functions…


what is http? diff b/n http and https? what are HTTP status codes?


Short for HyperText Transfer ProtocolHTTP is a set of standards that allow users of the World Wide Web to exchange information found on web pages. When wanting to access any web page enter http:// in front of the web address, which tells the browser to communicate over HTTP.Today’s modern browsers no longer require HTTP in front of the URL since it is the default method of communication.


Short for Hypertext Transfer Protocol over SecureHTTPS is a secure method of accessing or sending information across a web page. All data sent over HTTPS isencrypted before it is sent, this prevents anyone from understanding that information if intercepted. Because data is encrypted over HTTPS, it is slower than HTTP, which is why HTTPS is only used when requiring login information or with pages that contain sensitive information such as an online bank web page.

  • HTTPS uses port 443 to transfer its information.
  • HTTPS is first used in HTTP/1.1 and is defined in RFC 2616

1xx: Information

Message: Description:
100 Continue The server has received the request headers, and the client should proceed to send the request body
101 Switching Protocols The requester has asked the server to switch protocols
103 Checkpoint Used in the resumable requests proposal to resume aborted PUT or POST requests

2xx: Successful

Message: Description:
200 OK The request is OK (this is the standard response for successful HTTP requests)
201 Created The request has been fulfilled, and a new resource is created
202 Accepted The request has been accepted for processing, but the processing has not been completed
203 Non-Authoritative Information The request has been successfully processed, but is returning information that may be from another source
204 No Content The request has been successfully processed, but is not returning any content
205 Reset Content The request has been successfully processed, but is not returning any content, and requires that the requester reset the document view
206 Partial Content The server is delivering only part of the resource due to a range header sent by the client

3xx: Redirection

Message: Description:
300 Multiple Choices A link list. The user can select a link and go to that location. Maximum five addresses
301 Moved Permanently The requested page has moved to a new URL
302 Found The requested page has moved temporarily to a new URL
303 See Other The requested page can be found under a different URL
304 Not Modified Indicates the requested page has not been modified since last requested
306 Switch Proxy No longer used
307 Temporary Redirect The requested page has moved temporarily to a new URL
308 Resume Incomplete Used in the resumable requests proposal to resume aborted PUT or POST requests

4xx: Client Error

Message: Description:
400 Bad Request The request cannot be fulfilled due to bad syntax
401 Unauthorized The request was a legal request, but the server is refusing to respond to it. For use when authentication is possible but has failed or not yet been provided
402 Payment Required Reserved for future use
403 Forbidden The request was a legal request, but the server is refusing to respond to it
404 Not Found The requested page could not be found but may be available again in the future
405 Method Not Allowed A request was made of a page using a request method not supported by that page
406 Not Acceptable The server can only generate a response that is not accepted by the client
407 Proxy Authentication Required The client must first authenticate itself with the proxy
408 Request Timeout The server timed out waiting for the request
409 Conflict The request could not be completed because of a conflict in the request
410 Gone The requested page is no longer available
411 Length Required The “Content-Length” is not defined. The server will not accept the request without it
412 Precondition Failed The precondition given in the request evaluated to false by the server
413 Request Entity Too Large The server will not accept the request, because the request entity is too large
414 Request-URI Too Long The server will not accept the request, because the URL is too long. Occurs when you convert a POST request to a GET request with a long query information
415 Unsupported Media Type The server will not accept the request, because the media type is not supported
416 Requested Range Not Satisfiable The client has asked for a portion of the file, but the server cannot supply that portion
417 Expectation Failed The server cannot meet the requirements of the Expect request-header field

5xx: Server Error

Message: Description:
500 Internal Server Error A generic error message, given when no more specific message is suitable
501 Not Implemented The server either does not recognize the request method, or it lacks the ability to fulfill the request
502 Bad Gateway The server was acting as a gateway or proxy and received an invalid response from the upstream server
503 Service Unavailable The server is currently unavailable (overloaded or down)
504 Gateway Timeout The server was acting as a gateway or proxy and did not receive a timely response from the upstream server
505 HTTP Version Not Supported The server does not support the HTTP protocol version used in the request
511 Network Authentication Required The client needs to authenticate to gain network access

what are webservices?

In simple words, webservices will establish a good mode of communication with other servers. Lets say like this, we have temperature widgets everywhere(android,ios,windows etc etc). Now you want to display temperature in your widgets..will you code everywhere to show the temperature? its a very bad idea..instead you can easily call up some webservices through api’s where your api will contact to yahoo temperature server and display temperature. Here yahoo server will have a kind of method in public where receives parameters from different clients and then process and send back responses to the websites through webservices. This is how webservices will work..the same procedure will follow for cricket score updates, currency updates etc etc. Hope this is clear to get an basic idea of webservices..

web service is a method of communication that allows two software systems to exchange this data over the internet. The software system that requests data is called a service requester, whereas the software system that would process the request and provide the data is called a service provider.

Different software might be built using different programming languages, and hence there is a need for a method of data exchange that doesn’t depend upon a particular programming language. Most types of software can, however, interpret XML tags or Json. For more..clickhere

what are websockets?

HTML5 WebSocket represents the first major upgrade in the history of web communications. Before WebSocket, all communication between web clients and servers relied only on HTTP. Now, dynamic data can flow freely over WebSocket connections that are persistent (always on), full duplex (simultaneously bi-directional) and blazingly fast.

WebSockets come after many other technologies that allow servers to send information to the client. Web applications that use Comet/Ajax, push/pull and long polling all do this over HTTP. Other than handshaking the Upgrade Header, WebSockets is independent from HTTP.



Some advantages of WebSockets include:

• Cross origin communication (however this poses security risks)
• Cross platform compatibility (web, desktop, mobile)
• Low weight envelope when passing messages

For more:

what is curl?

PHP has a very powerful library of calls that are specifically designed to safely fetch data from remote sites. It’s called CURL. Enabling curl is explained here

For more:

how to maintain mysql security?

Security Guidelines :

  • Except MySQL root account do not permit anyone to access the user table in the mysql database.
  • Use the GRANT and REVOKE statements to control access to MySQL. Do not grant unnecessary privileges and never grant privileges to all hosts.
  • Never store simple text passwords in your database. Store the hash value using  SHA2(), SHA1()MD5() functions or other hashing function in different way. Try to use complex password.
  • Try to use a firewall and put MySQL behind the firewall.
  • 3306 is the default user port of MySQL and this port should not be accessible from untrusted hosts. You can scan the ports from Internet using a tool such as nmap. From a remote machine you can check whether the port is open or not with this command : shell> telnet server_host 3306. If telnet hangs or the connection is refused, the port is blocked. If you get a connection and some garbage characters, the port is open, and should be closed on your firewall or router, unless you really have a good reason to keep it open.
  • Some applications access MySQL database for different purpose. Never trust these input data entered by user and must validated properly before access database.
  • Do not transmit unencrypted data over the Internet. Use an encrypted protocol such as SSL (MySQL supports internal SSL connections) or SSH.
  • Use tcpdump and strings utilities. By issuing this command shell> tcpdump -l -i eth0 -w – src or dst port 3306 | strings you can check whether MySQL data streams are unencrypted or not.

Making MySQL Secure Against Attackers :

To make a MySQL system secure, you should maintain the following suggestions :

  • Require all MySQL accounts to have a password.
  • Make sure that the only Unix user account with read or write privileges in the database directories is the account that is used for running mysqld.
  • Never run the MySQL server as the Unix root user
  • Do not grant the FILE privilege to non administrative users
  • Do not permit the use of symlinks to tables.
  • Stored programs and views should be written using the security guidelines
  • If you do not trust your DNS, you should use IP addresses rather than hostnames in the grant tables.
  • If you want to restrict the number of connections permitted to a single account, you can do so by setting the max_user_connections variable in mysqld.

For more:

use of final method in oops?

final keyword, which prevents child classes from overriding a method by prefixing the definition with final. If the class itself is being defined final then it cannot be extended.

what is sql injection?

SQL Injection is one of the many web attack mechanisms used by hackers to steal data from organizations. It is perhaps one of the most common application layer attack techniques used today. It is the type of attack that takes advantage of improper coding of your web applications that allows hacker to inject SQL commands into say a login form to allow them to gain access to the data held within your database.

In essence, SQL Injection arises because the fields available for user input allow SQL statements to pass through and query the database directly.

For more:

what is callback function?

A callback is a piece of code that is passed to a function that is later executed by that function.

For more:

what are current php,mysql and apache versions?

php – 5.5.11

Mysql – 5.6.17

apache – 2.4.9


what is regex and explain in detail?

Regular expressions started out as a feature of the Unix shell. They were designed to make it easier to find, replace and work with strings — and since their invention, they’ve been in wide use in many different parts of Unix based Operating Systems. They were commonly used in Perl, and since then have been implemented into PHP.

what is DOM?

The Document Object Model (DOM) is an API for manipulating HTML and XML documents. It provides a structural representation of the document, enabling you to modify its content and visual presentation by using a scripting language such as JavaScript.

For more:

Json and explain in detail why we will use json?

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming LanguageStandard ECMA-262 3rd Edition – December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language. In simple words, its an alternative to XML.

For more:

what are active records?

how to maintain 2 domains in one server?

difference between == & ===?

$a == $b Equal TRUE if $a is equal to $b after type juggling.
$a === $b Identical TRUE if $a is equal to $b, and they are of the same type.

Event handler in php?

what is cross side scripting?

Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise benign and trusted web sites. XSS attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s browser has no way to know that the script should not be trusted, and will execute the script. Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by the browser and used with that site. 


difference b/n document.ready and window.onload?

The ready event occurs after the HTML document has been loaded, while the onload event occurs later, when all content (e.g. images) also has been loaded.

The onload event is a standard event in the DOM, while the ready event is specific to jQuery. The purpose of the ready event is that it should occur as early as possible after the document has loaded, so that code that adds funcionality to the elements in the page doesn’t have to wait for all content to load.

window.onload : A normal JavaScript event.

document.ready : An specific jQuery event when the entire HTML have been loaded.


document.ready() is jQuery event. Jquery document.ready function called once the DOM(Document object model) is loaded on your page.DOM means all the html tags/script I.e.(div tag, table tag,paragraph tag etc etc..). It will not wait for the images to get load. It means that it is the earliest stage in page load process.

Example : –

 $(document).ready(function(){// executes when HTML-Document is loaded and DOM is ready
 alert("document is ready to perform operation");});

Window .onload():-

window.onload() is a javascript function. The load event fires when all the content on your page loaded including the DOM (document object model) and images. Another difference between the two is we can have more than one document.ready() function in a web page but only one onload function.

Example : –

Suppose there is a large image on your page in that case window.onload wait for that image to completely load. When we use window.onload() execution will be slow but document.ready() will not wait for the image to load completely.

$(window).load(function(){// executes when complete page is fully loaded, including frames,objects and images
 alert("window is loaded to perform operations");});

what is hooks in drupal and basics/interview questions in drupal?

Clickhere for interview questions in drupal

difference between modules,extensions and plugins in joomla?


Plugins enable you to execute code in response to certain events, either Joomla core events or custom events that are triggered from your own code. This is a powerful way of extending the basic Joomla functionality.


Components are the main functional units that display in your template, like the content management system, contact forms, Web Links and the like. They are usually displayed in the center of the main content area of a template (depending on the template).


A more lightweight and flexible extension used for page rendering is a module. Modules are used for small bits of the page that are generally less complex and able to be seen across different components. Sometimes modules are linked to a component such as the core latest news module.


Components, languages, modules, plugins and templates collectively known as Extensions.


difference between wordpress, joomla and drupal?



difference between primary and unique key?

Primary Key:

1. Primary key does not accept null values.
2. There is only one primary key in a table.
3. Clustered index is created in Primary key.
4. Primary key allows each row in a table to be uniquely identified and ensures that no duplicate rows exist.

Unique Key:

1. Using Unique key, Null values are accepted.
2. More than one unique key can be defined  there in a table.
3. Non-Clustered index is created in unique key.
4. Unique key constraint is used to avoid the duplication of key values within the rows of a table.

INDEX is similar to the index at the back of a book. It provides a simplified look-up for the data in that column so that searches on it are faster. MyISAM uses a hash table to store indexes, which sorts the data, but is still linearly proportional in depth to the table size. InnoDB uses a B-tree structure for its indexes. A B-tree is similar to a nested set – it breaks down the data into logical child groups, meaning search depth is significantly smaller. As such, lookups by ranges are faster in a B-tree.

UNIQUE INDEX is an index in which each row in the database must have a unique value for that column. This is useful for preventing duplication, e.g. for an email column in a users table where you want only one account per email address. Important note that in MySQL, an ON DUPLICATE KEY UPDATE clause will trigger if it finds a duplicate unique index match, even if it’s not your primary key. This is a pitfall to be aware of if you have a unique on email, for example.

PRIMARY KEY is a UNIQUE INDEX that is the identifier for any given row in the table. As such, it must not be null, and is saved as a clustered index. Clustered means that the data in your table is sorted in ascending order on the PK. This makes searches on primary key significantly faster than any other index type (as in MySQL, only the PK may be your clustered index). Note that clustering also causes concerns with INSERT statements if your data is not AUTO_INCREMENTed, as MySQL will have to shift data around if you insert a new row with a PK with a lower ordinal value. This could hamper your DB performance.

FOREIGN KEY is a reference to a column in another table. It enforces Referential Integrity, which means that you cannot create an entry in a column which has a foreign key to another table if the entered value does not exist in the referenced table. In MySQL, a FOREIGN KEY does not improve search performance. It also requires that both tables in the key definition use the InnoDB engine, and have the same data type, character set, and collation.


declaration of variables in js?

difference between cookies and sessions?

Session Basics

Sessions are simply server-side cookies each with a corresponding client side cookie that contains only a reference to its server-side counterpart. When a user visits a page, the client sends the reference code to the server, and PHP will then match that reference code to a server-side cookie and load the data in the server’s cookie into the $_SESSION superglobal.


  1. Can store very large amounts of data easily.
  2. Save bandwidth by passing only a reference to the session each pageload. A client-side cookie has to pass all of its data.
  3. Data is stored on the web server. This makes sessions secure, because the data cannot be viewed or edited by the client.


  1. Ends when the browser is closed unless you’ve configured php.ini to extend sessions’ cookie lifetime. Cannot last forever.

Cookie Basics

Cookie data is sent to the web server every page load. PHP reads and stores the value into the $_COOKIE superglobal. When a cookie is created, you can give it a lifespan. After that lifespan runs out, it will expire.


  1. Can last as long as the website needs. They will still be there even if the browser is closed and reopened.
  2. Useful for “remember me” logins
  3. Useful for storing temporary user settings. For example, if a user is browsing a paginated list of items, sorted a certain way, the sorting setting can be stored in a cookie.


  1. Stored in the users filesystem. This means that the user can tamper with it and view it.
  2. Can only store a limited amount of data.
  3. Must pass all data to the webserver each pageload. This takes up more bandwidth.


what are stored procedures(sp) and use of sp in mysql?–net-17843

how to improve performance loading? how we will calculate performance of a website?

difference between echo and print?


  • Outputs one or more strings separated by commas
  • No return valuee.g. echo "String 1", "String 2"


  • Outputs only a single string
  • Returns 1, so it can be used in an expressione.g. print "Hello"or, if ($expr && print "foo")


  • Outputs a human-readable representation of any one value
  • Accepts not just strings but other types including arrays and objects, formatting them to be readable
  • Useful when debugging
  • May return its output as a return value (instead of echoing) if the second optional argument is given


  • Outputs a human-readable representation of one or more values separated by commas
  • Accepts not just strings but other types including arrays and objects, formatting them to be readable
  • Uses a different output format to print_r(), for example it also prints the type of values
  • Useful when debugging
  • No return value


  • Even though print can be used in an expression, I’d generally avoid doing so for the sake of readability (and because it’s unlikely to ever be useful). The precedence rules when it interacts with other operators can also be confusing.
  • Whereas echo and print are language constructs, print_r() and var_dump() are regular functions. You don’t need parentheses to enclose the arguments to echo or print (and if you do use them, they’ll be treated as they would in an expression).

difference between implode and explode?

  Explode() function divides a string into an array, but implode function() returns or combine a string from the   elements of an array.

$str = “Hello World”;
$str = explode(” “, $string); //here string delimeter is space
$str[0] = Hello;
$str[1] = World;
$array = array(‘Riss’,’Energy’,’India’);
$comma_separated = implode(“,”,$array);  //here comma is separated
echo $comma_separated;

use of extract?

The extract() function imports variables into the local symbol table from an array.

This function uses array keys as variable names and values as variable values. For each element it will create a variable in the current symbol table.

This function returns the number of variables extracted on success.


$a = “Original”;
$my_array = array(“a” => “Cat”,”b” => “Dog”, “c” => “Horse”);
echo “\$a = $a; \$b = $b; \$c = $c”;
Output: $a = Cat; $b = Dog; $c = Horse

use of permalinks in wordpress?

An easy way to improve your site’s search engine ranking is to use “pretty permalinks.” Permalinks are the direct and, well, permanent links to your blog entries. It’s what other websites will use to link to your content. “Pretty permalinks” is the term uses to mean “making your links look better and be more user friendly.”


what is taxanomy in wordpress and why it is used? in which table it is stored?

Taxonomy = Classifying data

By default, WordPress comes with 3 taxonomies, post tag, categories, link categories.  Essentially, a taxonomy is a way of classifying data. Typically a taxonomy will have a set of characteristics that is unique to it.

  • Post Tag: acts like a label, attached to a post.
  • Category: acts like a “bucket” in which we put posts, are often hierarchical. Posts can live in multiple categories.
  • Link Category: acts like a label, attached to a link.


what are hooks in wordpress?

WordPress hooks are, essentially, triggers of sorts that allow users to, with short snippets of code, modify areas a WordPress theme or plugin, or add their own code to various parts of WordPress without modifying the original files. An example of this could be add social bookmarking links to the end of the content.

Hooks can be divided into “Action” and “Filter” hooks, the former allowing for insertion of custom code at various points.

Action Hooks

Action hooks are designated points in the WordPress core, theme and plugin code where it is possible for outside resources to insert additional code and, there by, customise the code to do additional functions they may desire. An example of this is the commonly used wp_head action hook, used by many themes and plugins to inject additional CSS stylesheets, processing code or anything else they require to sit between the <head> and </head> tags.

To hook on to an action, create a function in your theme’s functions.php file (or in your plugin’s code) and hook it on using the add_action() function, as follows:

	add_action( 'wp_head', 'wpcandy_actionhook_example' );

	function wpcandy_actionhook_example () {

		echo '<meta name="description" content="This is the meta description for this page." />' . "

	} // End wpcandy_actionhook_example()

The above code adds the text “Hello WPCandy Readers!” between your theme’s <head> tags. Placing “wp_head” in the call to add_action() with “get_header” would display this text above your theme.

Filter Hooks

Filter hooks are used to manipulate output. An example of this would be to add a line or text (or a hyperlink, or a signature sign-off—whatever you’d like) to the end of the content of each of your blog posts.

Custom code is added as a filter using the add_filter() function. The following code adds a sign-off to the end of each blog post, only when viewing the full blog post screen:

	add_filter( 'the_content', 'wpcandy_filterhook_signoff' );

	function wpcandy_filterhook_signoff ( $content ) {

		if ( is_single() ) {

			$content .= '<div class="sign-off">Th-th-th-th-th That\'s all, folks!</div>' . "

		} // End IF Statement

		return $content;

	} // End wpcandy_filterhook_signoff()

The above code adds a new div tag to the end of the content of our blog post, only when on a single blog post screen.

A filter hook is like using the str_replace() function in PHP. You give it some data, manipulate, replace or reformat the data and return the new content out at the end.


how to convert an html5 template to wordpress template?

how to add custom fields to editor in wordpress?

codeigniter: folder structure of codeigniter? how do you fetch rows? how you will do in codeigniter for mysql_fetch_array()?

interview questions and basics of codeigniter?

session maintenance in codeigniter

how do u execute query?

OOPS: what is encapsulation,inheritance,polymorphism, method overloading, method overriding, abstract class, interface, object,class,constructor, data abstraction. Use of public,static,private and protected.

PHP: How do you increase upload filesize without change in php.ini file? In form what will you specify if you have upload option?


increase max_execution_time in php.ini file

Put this code in your file at the top.

ini_set('max_execution_time', 300); //300 seconds = 5 minutes

You can put this in the php.ini file.
max_execution_time = 30 ;

increase max_execution_time using htaccess file

php_value max_execution_time 259200

Increase post_max_size, upload_max_filesize,memory_limit,max_execution_time,max_input_time,session.gc_maxlifetime

php_value post_max_size 5M
php_value upload_max_filesize 5M
php_value memory_limit 300M
php_value max_execution_time 259200
php_value max_input_time 259200
php_value session.gc_maxlifetime 1200



MySQL: Diff b/n innerjoins and joins? types of joins? what are triggers? default engine in mysql? how you will change engine?

how do you keep password for DB? primary and foreign key relationship? groupby and orderby use?

HTML5: what are latest html5 elements? types of engines in html5? how do you validate html5? how you will debug? how you will store data in localstorage in html?

CSS3: Types of transitions in css3? diff b/n css2 and css3? diff b/n LESS and CSS3? diff between inline and external stylesheet? diff b/n margin and padding? list some important interview questions on html5 and css3

Jquery: diff b/n window.onload and document.ready? how you will change html content in a tag using jquery? regex?strip splashes and add splashes? functions & events in jquery in detail? show and hide in jquery?

JS: Use of js? how you will validate? how do you get or print value of html element using jquery?



How to find checked checkbox values in an array using jquery?


Would return the values of the checked/selected group1 checkboxes into an array like this:

var values =[18,55,10];

You can use the :checkbox and :checked pseudo-selectors and the .class selector, with that you will make sure that you are getting the right elements, only checked checkboxes with the class you specify.

Then you can easily use the Traversing/map method to get an array of values:

var values = $('input:checkbox:checked.group1').map(function(){returnthis.value;}).get();// ["18", "55", "10"]