Why we use strpos() in PHP ?

strpos() using to find the first occurrence of a string in another string. It return the position of the sub-string in a string.If the searched string will not exists in the searching string it return false.

$mystring = “PHP Developer”;
$find = “Developer”;
echo $result = strpos($mystring,$find);

OUTPUT: 4… Read more

What is difference between mysql_connect() and mysql_pconnect() ?

mysql_connect() and mysql_pconnect() both are working for database connection but with little difference. In mysql_pconnect(), ‘p’ stands for persistance connection.

When we are using mysql_connect() function, every time it is opening and closing the database connection, depending on the request .

But in case of mysql_pconnect() function,
First, when connecting, … Read more

What is the use of array_slice() in PHP ?

array_slice() is used to extract a slice of an array. It returns the sequence of elements from the array as specified by the parameters.

str_split()
<?php

$languageArray = array(“php”, “java”, “c++”, “pearl”, “python”);
$languages = array_slice($languageArray,0 ,2);

print_r($languages);

?>

OUTPUT: Array ( [0] =php [1] =java )… Read more