Author Archives: phpspider

Go Programming Language (Definition)

Go is an open source, procedural, compiled and statically typed programming language. It was designed and developed at Google by Rob pike, Ken Thompson and Robert Griesemer. It is syntactically similar to C, also provides some additional features memory safety, garbage collection, dynamic types. Some people called it golang also.

What is Accessor in Laravel?

As we know laravel accessor is very userful feature. It is used for creating the virtual attribute on the object which you want to access it as database column name. So for example if you want to show full name and in your database table (users) has first_name and last_name columns, you can write: Then you can call $user->full_name and it… Read More »

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><div id="content">Loading…</div> Step 2 : Paste the following code to head section under script tag of your webpage.   <script type="text/javascript"> google.load("language", "1");   function initialize() {… Read More »

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 $givenNumber = "1245fdfd8454D FDFDF434 3$#$#%"; $testingNumber = preg_replace(‘[D]’, ”, $givenNumber); echo $testingNumber; Output is : 124584544343

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;  … Read More »

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; } else{ return true; } }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; } else{ return… Read More »

How to share your page or website ?

<!– AddToAny BEGIN –> <div> <a href="http://www.addtoany.com/share_save?linkurl=url_here&linkname=xyz">Share</a> <span class="a2a_divider"></span> <a class="a2a_button_twitter"></a> <a class="a2a_button_f<acebook"></a> </div> <script type="text/javascript"> var a2a_config = a2a_config || {}; a2a_config.linkurl = "your url here"; </script> <script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script> <!– AddToAny END –><!– AddToAny BEGIN –> <div> <a href="http://www.addtoany.com/share_save?linkurl=url_here&linkname=xyz">Share</a> <span class="a2a_divider"></span> <a class="a2a_button_twitter"></a> <a class="a2a_button_f<acebook"></a> </div> <script type="text/javascript"> var a2a_config = a2a_config ||… Read More »

Validate URL in PHP

To validate url at server side use this function. In this function $variable defines the your string which you want to validate. <?php $reg_exp = /(http?://)?([da-z.-]+).([a-z.]{2,6})([/w ?=.-]*)*/?$/ ereg($reg_exp,$variable); ?><?php $reg_exp = /(http?://)?([da-z.-]+).([a-z.]{2,6})([/w ?=.-]*)*/?$/ ereg($reg_exp,$variable); ?>