Tutorials

Category

26 posts found

11 Mar 2014
0.73K
No Comments

Define array to for shuffle keys [php]$numbers = array( ‘one’ => ‘one_1′ ,’two’ => ‘two_2′ ,’three’ => ‘three_3′ ,’four’ => ‘four_4′ ,’five’ => ‘five_5′ ,’six’ => ‘six_6′ ,’seven’ => ‘seven_7′ ,’eight’ => ‘eight_8′ ,’nine’ => ‘nine_9′ ,’ten’ => ‘ten_10’ ); [/php] Define array indexes to get random keys in while

Post in

11 Mar 2014
0.31K
No Comments

[php] $numbers = array( ‘one’ => ‘one’ ,’two’ => ‘two’ ,’three’ => ‘three’ ,’four’ => ‘four’ ,’five’ => ‘five’ ,’six’ => ‘six’ ,’seven’ => ‘seven’ ,’eight’ => ‘eight’ ,’nine’ => ‘nine’ ,’ten’ => ‘ten’ ); foreach($numbers as $num_key=>$num_val){ $array_keys[$num_key] =$num_key; } //RESULT Array ( [one] => one [two] => two

Post in

10 Mar 2014
0.6K
No Comments
Develop code testing system on your localhost

Its hard to test your small code or function on files, because these serve our time to open files and write code save with die or exit in the file and then go to browser for testing, or we go to online php testing tools, but online php testing tools

Post in

10 Mar 2014
0.69K
No Comments

Sometimes we want call a function if user pressed two keys together at the same time. Like Shift+Enter, CTRL+S  more others, I wrote a little code how to call a function if user pressed two keys. copy keys name from another post to use easily with key names. [javascript] var

Post in

10 Mar 2014
0.39K
No Comments

1.Remove duplicate values from array – ARRAY_UNIQUE [php] $array = array(0,1,2,3,3,4,5,5,7,8,7,7); $array = array_unique($array); [/php] Result [php] Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [5] => 4 [6] => 5 [8] => 7 [9] => 8 ) [/php] 2.Re-order with random values from

Post in

21 Feb 2014
0.93K
No Comments
PHP Select optgroup from array

I have a array that contains continent and with countries. [php] Array ( [0] => Array ( [continent_name] => asia [country_name] => pakistan [country_value] => 1 ) [1] => Array ( [continent_name] => asia [country_name] => india [country_value] => 2 ) [2] => Array ( [continent_name] => asia [country_name] =>

Post in

5 Jan 2014
0.45K
No Comments

make $wpdb global variable [php] global $wpdb; //NOW GET YOUR WORDPRESS DATABASE TABLE PREFIX $prefix =  $wpdb->base_prefix; ///`WP_` IS DEFAULT PREFIX [/php

Post in

15 Dec 2013
0.3K
No Comments

Many times we need to store #array in #database with because may we don’t want to create all specified fields with names in #database table, so we just inserted, and here is example that I want to save whole #array data in database table field mysql. [php] $save_array = array(

Post in

15 Dec 2013
0.54K
No Comments

I was also faced that problem  the unchecked checkboxes cannot submit the data when submit form,  so I decided to a write a jquery, here is my html [html] <input type="checkbox" value="1" checked="checked" named="checked_checkbox" /> <input type="checkbox" value="1" named="un_checked_checkbox" /> [/html] When I using print_r($_POST) ; its just return [php]

Post in

29 Nov 2013
0.31K
No Comments

this function allow you to generate random characters code,function suitable for Generate activation code for newly user account Generate shortenURL code, Generate temporary user password for changing password of account. [php] function generate_special_pass($pass_len = 8, $allow_special_chrs = true) { $allow_chrs = ‘ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz’; $special_chrs = ‘!@#$%^&*()_+’; if($allow_special_chrs) { $pass_chrs = $allow_chrs.$special_chrs;

Post in