Tagged: php Toggle Comment Threads | Keyboard Shortcuts

  • Christofian 9:09 pm on January 2, 2012 Permalink
    Tags: php   

    http://stackoverflow.com/questions/8641181/html-form-to-multiple-emails How to handel multiple items in forms (such as multiple email addresses)

    Advertisements
     
  • Christofian 6:12 pm on December 31, 2011 Permalink
    Tags: php   

    Foreach and arrays 

    I had a mysql query, and I needed to store the data for later. So, I:

    1.created an array

    $array = array();

    2. as I looped through the mysql data, I added that data to the array

    $array[] = $mysqldata;

    3. I then later used a foreach to loop through the array:

    foreach($array  as $data) { //this code looped through $array, and each time it get's data from the array it assignes it to $data
    echo $data;
    }

    Bonus: foreaching through two arrays:

    foreach(array_combine($array, $array1)  as $data => $data1) {
    echo $data;
    echo $data1;
    }

    Extra Bonus: foreaching with three arrays:

    foreach (array_map(NULL, $array1, $array2, $array3) as $x) {
      list($array1, $array2, $array3) = $x;
    echo $array1;
    echo $array2;
    echo $array3;
    }
     
  • Christofian 1:23 am on December 30, 2011 Permalink
    Tags: php   

    To “sort” dates in php, see here: http://stackoverflow.com/questions/2832467/php-how-can-i-check-if-the-current-date-time-is-past-a-set-date-time

    Use strtotime (http://php.net/manual/en/function.strtotime.php) to convert 06-07-2012 to a unix time format that php can sort.

    Update: difference between mm-dd and dd-mm: http://stackoverflow.com/questions/8554414/strtotime-not-working-with-mm-dd-yyyy

     
  • Christofian 10:06 pm on December 28, 2011 Permalink
    Tags: php   

    this is pretty cool:

    /*
    echo "hi";
    echo "hey"; // */
    

    Now, I can quickly comment and comment that line of code by removing the topmost /*. See here

    echo "hi";
    echo "hey"; // */
    
     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel