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.
Both the functions are used to Split a string. However,
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"; ?>
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.
You can do it by 4 Ways