Results 1 to 7 of 7

Thread: [PHP] Giving away free help :)

  1. #1

    Joined
    Aug 2012
    Posts
    26
    Thanks
    1
    Thanked
    0/0
    DL/UL
    4/0
    Mentioned
    3 times
    Time Online
    N/A
    Avg. Time Online
    N/A

    [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 04:21 AM.

  2. #2
    Superboy's Avatar
    Joined
    Aug 2012
    Posts
    226
    Userbars
    2
    Thanks
    1
    Thanked
    3/3
    DL/UL
    1/0
    Mentioned
    23 times
    Time Online
    1h 8m
    Avg. Time Online
    N/A
    Hey! Perfect thread for me

    Can't seem to be able to download this script
    (you need an account to see links)

    Install button does nothing..

    Anyway to manually install it into GM?

  3. #3

    Joined
    Aug 2012
    Posts
    26
    Thanks
    1
    Thanked
    0/0
    DL/UL
    4/0
    Mentioned
    3 times
    Time Online
    N/A
    Avg. Time Online
    N/A
    Umm..
    Thats not a php question.
    But download it and drag it into your browser.

  4. #4
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    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

    Joined
    Aug 2012
    Posts
    26
    Thanks
    1
    Thanked
    0/0
    DL/UL
    4/0
    Mentioned
    3 times
    Time Online
    N/A
    Avg. Time Online
    N/A
    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 02:25 PM.

  6. #6
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    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.
    (you need an account to see links) and (you need an account to see links)

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

    lilewing23 (08-09-2012)

  8. #7

    Joined
    Aug 2012
    Posts
    26
    Thanks
    1
    Thanked
    0/0
    DL/UL
    4/0
    Mentioned
    3 times
    Time Online
    N/A
    Avg. Time Online
    N/A
    Quote Originally Posted by Zachafer View Post
    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
  •