Results 1 to 6 of 6

Thread: personal web page

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2010
    Location
    Arthunkal
    Posts
    17

    Default personal web page

    PHP array_walk_recursive() Function

    <?php
    function myfunction($value,$key)
    {
    echo "The key $key has the value $value<br />";
    }
    $a1=array("a"=>"Cat","b"=>"Dog");
    $a2=array($a1,"1"=>"Bird","2"=>"Horse");
    array_walk_recursive($a2,"myfunction");
    ?>

  2. #2
    Join Date
    Oct 2010
    Location
    Arthunkal
    Posts
    17

    Default personal web page

    PHP key() Function


    <?php
    $people = array("Peter", "Joe", "Glenn", "Cleveland");
    echo "The key from the current position is: " . key($people);
    ?>

  3. #3
    Join Date
    Oct 2010
    Location
    Arthunkal
    Posts
    17

    Default personal web page

    PHP shuffle() Function




    <?php
    $my_array = array("a" => "Dog", "b" => "Cat", "c" => "Horse");

    shuffle($my_array);
    print_r($my_array);
    ?>

  4. #4
    Join Date
    Oct 2010
    Location
    Arthunkal
    Posts
    17

    Default personal web page

    PHP uksort() Function

    <?php
    function my_sort($a, $b)
    {
    if ($a == $b) return 0;
    return ($a > $b) ? -1 : 1;
    }

    $people = array("Swanson" => "Joe",
    "Griffin" => "Peter", "Quagmire" => "Glenn",
    "swanson" => "joe", "griffin" => "peter",
    "quagmire" => "glenn");

    uksort($people, "my_sort");

    print_r ($people);
    ?>

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •