PHP Questions
- What is Singleton Pattern?
- Answer:
Singleton Pattern - is a design pattern that restricts the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system. The concept is sometimes generalized to systems that operate more efficiently when only one object exists, or that restrict the instantiation to a certain number of objects.
Added By : Sanjay
- What is the difference between Split and Explode?
- Answer:
Both the functions are used to Split a string. However,
Difference is:-
Split - Splits string into array by regular expression.
Explode - Split a string by string.
Description:
Split is used to split a string using a regular expression. On the other hand, Explode is used to split a string using another string.<?php // Delimiters may be slash, dot, or hyphen $date = "04/30/1973"; list($month, $day, $year) = split('[/.-]', $date); echo "Month: $month; Day: $day; Year: $year"; ?> <?php // Delimiters is / $date = "04/30/1973"; list($month, $day, $year) = explode('/', $date); echo "Month: $month; Day: $day; Year: $year"; ?>
For Example:
explode(" and ", "Hello and World and Program");
split(" : ", "Hello : World : Program");
Both of these functions will return an array that contains Hello, World, and Program.
Added By : Praveen Kumar
- How can we retrieve the data in the result set of MySQL using PHP?
- Answer:
You can do it by 4 Ways
1. mysql_fetch_row
2. mysql_fetch_array
3. mysql_fetch_assoc
4. mysql_fetch_object
Added By : Jagdish Gupta
Also Exercise
Post Your Question
Social Sharing
Search
Articles
Recently Added Jobs
Rajasthan High Court - Jodhpur Recruitment 2017 for Civil Judges
Last Date: 21 December, 2017
Last Date: 21 December, 2017
WBSEDCL Recruitment - 2017 for Office Executive
Last Date: 16 May, 2017
Last Date: 16 May, 2017
RECRUITMENT OF PROBATIONARY OFFICERS IN STATE BANK OF INDIA
Last Date: 06 March, 2017
Last Date: 06 March, 2017
UPSC Combined Medical Services Examination 2015
Last Date: 10 April, 2015
Last Date: 10 April, 2015
UPSC Engineering Services Examination 2015
Last Date: 10 April, 2015
Last Date: 10 April, 2015