PHP

Category

35 posts found

13 Sep 2014
0.32K
No Comments

There no any function available in php to detect string, this technique is used when user type login name with CAPITAL CASE, CameL caSe or Title case, web developer also prevent these type cases of string for user account loginanme because they assigned unique column of username in database, I wanted to use

Post in

5 Jul 2014
0.33K
No Comments

FUNCTION TO CHECK IF IS EVEN NUMBER [php] function is_even($number=null){ return(!($number & 1)); } <pre> [/php] FUNCTION TO CHECK IF IS ODD NUMBER [php] function is_odd($number=null){ return($number & 1); } [/php

Post in

3 Jul 2014
2.35K
2 Comments

[php]function measure_conversation($value = null, $measurein = null, $returnin = ‘px’, $return_value = true){ $measurein = preg_replace(‘/[^a-zA-Z0-9]/’,”,$measurein); $value = preg_replace(‘/[^\d]/’,”, $value); if (!is_numeric($value) && $measurein === null) { return false; } switch (strtolower($measurein)) { case "pt": $px = $value * (1.333333333333); $pt = $value; $mm = $value * (0.3527777777778); $cm =

Post in

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.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.92K
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

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