How to check cURL is supported or not using PHP

/* Check for curl extension */
function _iscurlsupported() {
if (in_array (‘curl’, get_loaded_extensions())) {
return true;
else {
return false;

if (_iscurlsupported()) {
echo “cURL is supported\n”;
else {
echo “cURL isn’t supported\n”;

Get month name from number in PHP

Please find below code

$date = date_parse($month);
$month_number = $date[‘month’];

switch ($m) {
case “January”:
case “Jan”:
$m = “01”;
case “Febuary”:
case “Feb”:
$m = “02”;
case “March”:
case “Mar”:
$m = “03”;
case “April”:
case “Apr”:
$m = “04”;
case “May”:
$m = “05”;
case “June”:
case “Jun”:
$m = “06”;
case “July”:
case “Jul”:
$m = “07”;
case “August”:
case “Aug”:
$m = “08”;
case “September”:
case “Sep”:
$m = “09”;
case “October”:
case “Oct”:
$m = “10”;
case “November”:
case “Nov”:
$m = “11”;
case “December”:
case “Dec”:
$m = “12”;
$m = false;

Generate random string in PHP

/*Random String*/
function generateRandomString($length = 2) {
$characters = ‘0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’;
$charactersLength = strlen($characters);
$randomString = ”;
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength – 1)];
return $randomString;
/*Random String*/

PHP MySQL connect, insert, select data from advanced version…

$dbHost = ‘localhost’;
$dbUsername = ‘root’;
$dbPassword = ”;
$dbName = ‘db_name’;
//Connect with the database
$db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);

if ($db->connect_errno) {
printf(“Connect failed: %s\n”, $db->connect_error);
/*Get data from table*/
$accounts = $db->query(“SELECT * FROM table_name”);

while($row = $accounts->fetch_assoc()){
echo $row[‘sub_id’];

/*Store data in table*/

$query = “INSERT INTO table_name VALUES (‘$str’)”;
$sql = $db->query($query);

HTTP Error 404.3 – Not Found The page you are requesting cannot be served because of the extension configuration. If the page is a script, add

If this is related IIS 7.5 Detailed Error – 404.3  – Not Found

We need to map json or CSS like blow

1- Open your project’s Web.config file
2- Under <system.webServer> add the MIME mapping to handle the file extension you need, like so:






3- Rebuild the solution and watch for the same error. Most likely this should resolve the issue handling .less files. You can add handlers for any type of file with another <mimeMap fileExtension=” mimeType=”” />

PHP String functions with examples

Please find below string functions in daily use

trim() : It removes all the whitespaces from both sides of a string,
ltrim() and rtrim() for removing them from only one side of the string (left or right).

It convert string to array based on comma, space etc…
Ex: echo explode(” “,$arr); // Array

It convert array to string
Ex: echo implode(” “,$arr); // String

It’s used for replace word
Ex: echo str_replace(“world”,”Peter”,”Hello world!”);
//world replaced with peter

Perform a regular expression search and replace
Ex: $str = preg_replace(‘/\s+/’, ”, $str);
// But if it could be due to space, tab…you can use

It encode’s the string

Splits a string into an array

Compares two strings (case-sensitive) returns ‘0’ when true.


we are having lot of string functions please find below URL….

What is PHP and Why do I need it?

PHP is probably the most popular scripting language on the web. It is used to enhance web pages. With PHP, you can do things like create username and password login pages, check details from a form, create forums, picture galleries, surveys, and a whole lot more. If you’ve come across a web page that ends in PHP, then the author has written some programming code to liven up the plain, old HTML.

PHP is known as a server-sided language. That’s because the PHP doesn’t get executed on your computer, but on the computer you requested the page from. The results are then handed over to you, and displayed in your browser. Other scripting languages you may have heard of are ASP, Python and Perl. (You don’t need to know any of these to make a start on PHP. In fact, these tutorials assume that you have no programming experience at all.)

The most popular explanation of just what PHP stands for is “Hypertext Pre-processor”. But that would make it HPP, surely? An alternative explanation is that the initials come from the earliest version of the program, which was called Personal Home Page Tools. At least you get the letters “PHP” in the right order!

But PHP is so popular that if you’re looking for a career in the web design/web scripting industry then you just have to know it! In these tutorials, we’ll get you up and running. And, hopefully, it will be a lot easier than you think.

To learn PHP follow below websites