How to check for file existence in Laravel’s Blade template

File exists
Could not find file


How to Translate Text to desired language ?

Just follow these steps and copy & paste the code you can translate text easily.

Step 1 : Make a div with id (id is compulsory)
Like <div id="content">Loading…</div>

Step 2 : Paste the following code to head section under script tag of your webpage.
google.load(“language”, “1”);

function initialize() {
var content = document.getElementById(‘content’);
// Setting the text in the div.
content.innerHTML = ‘<div id=”text”>Place Your Text Here (Hola, me alegro mucho de verte.)<\/div><div id=”translation”/>’;

// Grabbing the text to translate
var text = document.getElementById(“text”).innerHTML;

// Translate from Spanish to English, and have the callback of the request
// put the resulting translation in the “translation” div.
// Note: by putting in an empty string for the source language (‘es’) then the translation
// will auto-detect the source language.
google.language.translate(text, ‘es’, ‘en’, function(result) {
var translated = document.getElementById(“translation”);
if (result.translation) {
translated.innerHTML = result.translation;

Step 3 : And the final Step is paste the following URL in src of script tag.

Above example is translating Spanish to English You can translate as your choice.
Just change the code in
google.language.translate(text, ‘es’, ‘en’, function(result)
es stands for Spanish,
en stands for English
You can find more language code at

How to Remove Characters Except Numbers from a String ?

Following Code will remove all character,special characters including space.

$givenNumber = “1245fdfd8454D FDFDF434 3$#$#%”;

$testingNumber = preg_replace(‘[\D]’, ”, $givenNumber);

echo $testingNumber;

Output is : 124584544343

Difference between strstr() and stristr() functions in PHP.

Both functions are used to return or finds the first occurence of a substring from a string, and give all string from first occurence to end of string except than stristr() is case-insensitive.
If no match is found then FALSE will be returned.

$email = ‘’;
$host = strstr($email, ‘@’);
echo $host;

stristr() does the same thing in Case-insensitive manner

How to Find Quarter Month From Any Year ?

A Quarter means 1/4 part of year.
In the following example given Script is
use to find which quarter of the year
in the given date.

Assuming given date is 10 December 2015
Following is the Example.
Just Copy & Paste and Enjoy.

$month = 12;
$date = 10;
$year = 2015;
$qm = mktime(0,0,0,$month,$date,$year);
echo ceil(date(“m”, $qm)/3);

Validate Email in PHP

Use this function to validate email in PHP.

Pass your email in this function by calling it.if  it returns false then email is not valid else valid.

function checkEmail($email_address = null){
if(preg_match(“/^[a-zA-Z]*\w+(\.\w+)*\@\w+(\.[0-9a-zA-Z]+)*\.[a-zA-Z]{2,4}$/”, $email_address) === 0){
return false;
return true;

How to share your page or website ?

<!– AddToAny BEGIN –>
<a href=” here&amp;linkname=”>Share</a>
<span class=”a2a_divider”></span>
<a class=”a2a_button_twitter”></a>
<a class=”a2a_button_facebook”></a>
<script type=”text/javascript”>
var a2a_config = a2a_config || {};
a2a_config.linkurl = “url her”;
<script type=”text/javascript” src=””></script&gt;
<!– AddToAny END –>