PDA

View Full Version : [PHP] Giving away free help :)



Steak
08-09-2012, 04:09 AM
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

Superboy
08-09-2012, 10:21 AM
Hey! Perfect thread for me

Can't seem to be able to download this script
[Only registered and activated users can see links]

Install button does nothing..

Anyway to manually install it into GM?

Steak
08-09-2012, 01:50 PM
Umm..
Thats not a php question.
But download it and drag it into your browser.

Zachafer
08-09-2012, 02:02 PM
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)

Steak
08-09-2012, 02:20 PM
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;
}

Zachafer
08-09-2012, 02:40 PM
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.
[Only registered and activated users can see links] and [Only registered and activated users can see links]

Steak
08-09-2012, 02:41 PM
None of this is your code.
[Only registered and activated users can see links] and [Only registered and activated users can see links]

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.