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?
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.
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?
Umm..
Thats not a php question.
But download it and drag it into your browser.
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)
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.
None of this is your code.
(you need an account to see links) and (you need an account to see links)
lilewing23(08-09-2012)