Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Extract method in PHP

Sometime we may need to use the same variable name that you are using in the query or simply in an associative array. Lets say you have an associative array : $arr = array( 'totalLimit' => 50, 'limit' => 10 ); The usually what we...

Using HeroDocs in php

Herodocs are useful for multi-line strings and avoiding quoting issues. It prevents from escapinging of characters in php EX1 ) $sql = <<<SQL select * from TABLE_NAME where id =1 and product_name = "widgets" SQL; O/...

How to create a class and object in php

class rect { public $length=0; public $width=0; public $area=0; public function getData() { $this->length=10; $this->width=20; } public function area() { $this->area = $this->leng...

Problem with foreach loop for updating array element

If we are traversing an array and need to update an element in some condition then it is quite tricky to do that in foreach loop. For example, if we need to increase each element by 2 of an integer array then we can do that using for loop in t...

Jquery vallidator rule for filling at least one field between a group

<script type="text/javascript"> $(document).ready(function() { jQuery.validator.addMethod("require_from_group", function (value, element, options) { var numberRequired = options[0]; var selector = options...

Parsing CSV file using php SplFileObject class.

The SplFileObject class provides an object oriented interface for a file. $file="upload_file.csv"; //file to parse Steps: 1) Create SplFileObject class object to the csv file. $srcFile = new SplFileObject($file); 2)Now loop ti...

Kohana issue on GoDaddy Shared Hosting

Recently while working for a project I faced an issue while making the site live. The site was developed with kohana framework and was to be hosted on Godaddy Server (Shared Hosting) and I faced a peculiar issue on the server giving me an erro...

Checking the date entered is according to a predefined format or not ?

Checking the date entered by the user correct of not as according to a predefined format or not. Example 1) $format = 'd-m-Y'; $input = 'asasasawasa-sldjs'; $date = DateTime::createFromFormat($format, $input); if($date) echo '...

How to create profile url in cakephp?

Hello readers ! Few days back I was facing issue to make public profile page in cakephp. And want to hide controller and action name from url for this I used the below code in routes.php and its work fine. Router::connect( '/:usernam...

Difference between array_slice() and array_splice()

**array_slice() Vs array_splice()** What arrayslice() function do: As name suggest this function just return part/slice of array which we pass to arrayslice() function as parameter 1 depending u...

Login either Username or Email using Authentication Plugin in Joomla

With the help of this Plugin user can login either with email or username . This plugin is compatible with Joomla 1.5, Joomla 2.5 and Joomla 3.1 . How to install Login to Joomla Administrator. Install with Joomla installer Proceed to y...

PHP array to JavaScript array conversion

Sometimes, I feel a need to get a PHP array in my JavaScript code. Earlier I make use of implode function of php but recently found new way using json_encode that works very effectively. Here is my php array: <?php $cool_epl_clubs_php =...

Sending xml data in post using curl

$xmldata =' <mail> <receive>you</receive> <sender>Surit</sender> <subject>Call me</subject> <message>XYZ</message> </mail> '; $url = "your url"; $curlConn = curl_init($url)...

Features for an e-Commerce Online Store

What is an e-Commerce? e-Commerce is doing business online and electronically. e-Commerce is about buying and selling products and services on the Internet. The sellers are individuals, small businesses or large corporations. The buyers are...

Using Auth method for login in cakephp

First of all load the component in the controller lets say UsersController using the below code $this->uses=array(Auth); login.view: <?php echo $this->Form->create('User', array('id'=>'signUpForm','name'=>'userSignu...

Date/Time Operations in php

Sometime there is a need to perform different operation on dates for ex: You may need to : 1) Add two dates/time 2) Subtract two dates/times for ex- to calculate your age by deducting your date of birth from current date. And many m...

Formatting time

Some time you may need to find the day, hour and min and seconds for ex: *you entered a number 105 and you want 1h-45Min ago* then you can simply use the following function although you can use your custom function as well depends on the...

Decomposing the associative array in chunks based on their keys

Consider you have two arrays like the below: 1) $arr1 = Array ( [0] => 2 [1] => 2 [2] => 2 [3] => 3 [4] => 3 ) 2) $arr2 = Array ( [0] => 28 [1] => 48 [2] => 21 [3] ...

iphone and Android Push Notification API

Push notifications are messages that allow an app to notify of a message similar to how a text message pops up on your screen with a sound. Code for Android ,Iphone API push notification is given below by using urbanairship. 1.Android Push No...
1 16 18 next
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: