PHP
Category
35 posts found
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
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
[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
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
[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
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
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
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
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
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]
TOP COMMENTED
laravel remove public from url
This is weird thing from #laravel on fresh installation, so…
3 comments
Pakistani Web Designer’s Web Designing…
Web Design Illustrations - IdealHut.com by Design-Maker…
2 comments
MEASURE UNITS PX, CM, IN, MM CONVERSION…
[php]function measure_conversation($value = null, $measurein = null, $returnin = 'px',…
2 comments
28 Android IOS Mobile Application Frameworks
jQuery Mobile Ionic: Advanced HTML5 Hybrid Mobile App Framework Mobile…
2 comments
20 jQuery HTML5 Video Player for Website
Video.js The Player Framework MediaElement.js - HTML5 video player Create…
2 comments