Results 1 to 7 of 7

Thread: [PHP] Giving away free help :)

  1. #1
    Banned
    Join Date
    Aug 2012
    Gender
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts


    Downloads
    4
    Uploads
    0
    Mentioned
    3 Post(s)
    Time Online
    N/A
    Avg. Time Online
    N/A
    Rep Power
    0

    [PHP] Giving away free help :)

    Ask me any question.. Ive done programming for 7 years. So i know pretty much what there is to know about it.

    Tags:
    scripting, php, coding, website, help, free, code, scripts, clraik, html, css, php.net
    Last edited by Steak; 08-09-2012 at 05:21 AM.

  2. #2
    Superboy's Avatar
    Join Date
    Aug 2012
    Gender
    Location
    FL
    Age
    25
    Posts
    226
    Thanks
    1
    Thanked 3 Times in 3 Posts


    Downloads
    1
    Uploads
    0
    Mentioned
    23 Post(s)
    Time Online
    N/A
    Avg. Time Online
    N/A
    Rep Power
    6
    Hey! Perfect thread for me

    Can't seem to be able to download this script
    http://userscripts.org/scripts/show/52294

    Install button does nothing..

    Anyway to manually install it into GM?

  3. #3
    Banned
    Join Date
    Aug 2012
    Gender
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts


    Downloads
    4
    Uploads
    0
    Mentioned
    3 Post(s)
    Time Online
    N/A
    Avg. Time Online
    N/A
    Rep Power
    0
    Umm..
    Thats not a php question.
    But download it and drag it into your browser.

  4. #4
    Little Brother


    Zachafer's Avatar
    Join Date
    Dec 2011
    Gender
    Posts
    1,206
    Thanks
    723
    Thanked 1,392 Times in 651 Posts


    Downloads
    81
    Uploads
    17
    Mentioned
    497 Post(s)
    Time Online
    21 d 17 h 32 m
    Avg. Time Online
    16 m
    Rep Power
    14
    Given two arrays of strings, A and B.

    B contains every element in A, and has one additional member, ie:
    A = ['dog', 'cat', 'monkey]
    B = ['cat', 'rat', 'dog', 'monkey']

    Write a function to find the extra string in B. Do this in O(n)

  5. #5
    Banned
    Join Date
    Aug 2012
    Gender
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts


    Downloads
    4
    Uploads
    0
    Mentioned
    3 Post(s)
    Time Online
    N/A
    Avg. Time Online
    N/A
    Rep Power
    0
    Php has a easy build in function called Array_diff.
    This is how i would use it:
    $array1 = array("a" => "green", "red", "blue", "red");
    $array2 = array("b" => "green", "yellow", "red");
    $result = array_diff($array1, $array2);

    print_r($result)

    or in a function where it adds the deleted values from the original array.

    function array_diff_($old_array,$new_array) {
    foreach($new_array as $i=>$l){
    if($old_array[$i] != $l){
    $r[$i]=$l;
    }
    }

    //adding deleted values
    foreach($old_array as $i=>$l){
    if(!$new_array[$i]){
    $r[$i]="";
    }
    }
    return $r;
    }
    Last edited by Steak; 08-09-2012 at 03:25 PM.

  6. #6
    Little Brother


    Zachafer's Avatar
    Join Date
    Dec 2011
    Gender
    Posts
    1,206
    Thanks
    723
    Thanked 1,392 Times in 651 Posts


    Downloads
    81
    Uploads
    17
    Mentioned
    497 Post(s)
    Time Online
    21 d 17 h 32 m
    Avg. Time Online
    16 m
    Rep Power
    14
    Quote Originally Posted by Steak View Post
    Php has a easy build in function called Array_diff.
    This is how i would use it:
    $array1 = array("a" => "green", "red", "blue", "red");
    $array2 = array("b" => "green", "yellow", "red");
    $result = array_diff($array1, $array2);

    print_r($result)

    or in a function where it adds the deleted values from the original array.

    function array_diff_($old_array,$new_array) {
    foreach($new_array as $i=>$l){
    if($old_array[$i] != $l){
    $r[$i]=$l;
    }
    }

    //adding deleted values
    foreach($old_array as $i=>$l){
    if(!$new_array[$i]){
    $r[$i]="";
    }
    }
    return $r;
    }
    None of this is your code.
    http://php.net/manual/en/function.array-diff.php and http://www.php.net/manual/en/functio...iff.php#105059

  7. The Following User Says Thank You to Zachafer For This Useful Post:

    lilewing23 (08-09-2012)

  8. #7
    Banned
    Join Date
    Aug 2012
    Gender
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts


    Downloads
    4
    Uploads
    0
    Mentioned
    3 Post(s)
    Time Online
    N/A
    Avg. Time Online
    N/A
    Rep Power
    0
    I know buddy I said php has a build in function.
    Thats why i used php.net, no need to make the problem harder than it is.

Posting Permissions

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