I have three associative arrays.
$combinedSettings
$userSettings
$defaultSettings
My function must combine the key and value from $userSettings and $defaultSettings into the $combinedSettings array.
$userSettings will always contain more keys than $defaultSettings will ever have.
So every once in a while there is an extra key and of course it's value in the $userSettings array than in the $defaultSettings array.
If the value of a key in $userSettings is empty we then use the value for the same key in the $defaultSettings. Every key in $defaultSettings will always be present in $userSettings. $userSettings just adds a few extra keys and their values.
Below is my working code but I am wondering if there is some way to make it more efficient, faster, perhaps with less code. It looks rather clutzy to me. Rather bloated.
Code: while (list($userKey, $userValue) = each($userSettings)) {
while ($defaultKey = key($defaultSettings)) {
$defaultValue = current($defaultSettings);
if ($userKey === $defaultKey) {
if ($userValue === "") {
$combinedSettings[$defaultKey] = $defaultValue;
} else {
$combinedSettings[$userKey] = $userKey;
}
next($defaultSettings); // to allow key() to work properly above.
} else { // add userSettings setting and value to combinedSettings and leave
// defaultSettings where it is.
$combinedSettings[$userKey] = $userValue;
}
break;
}
}
Thanks.
getAlexaRank($url) function not working
I have made a function to get alexa rankthe site is here: http://mytestsite.rack111.com/1but the Alexa rank is showing up blank and I dont know why can someone please tell me if there is something
Oracle11g Patch issue
Hi all,I'm getting the following error while installing Oracle11g Patch 11.1.0.7.0 on IBM-AIX/oracle/Disk1/stage/Components/oracle.owb.rsf/11.1.0.7.0/1/Datafiles/filegroup16.jar.when I look into the
Are sessions secure at all?..
I haven't really gotten into yet, but I was just thinking of something weird..Lets say you have a session element $_SESSION['is_admin']..Is that easy to modify the cookie or whatnot and change it to
Two warning messages
Quote<b>Warning</b>: mysql_real_escape_string() expects parameter 1 to be string, array given in
Create or replace package is ending ORA-21700
Database 9.2.0., patch 8 (9.2.0.8.0).
Need help to identify this error please
:confused:Can anyone help me tell what this error message means? Maybe tell me where to look to fix the error as well?Thanks
Update Myspace status with CURL
Logging in:Code: <?phpclass Myspace{ function login($username, $password) { $username = $_POST['user']; $password = $_POST['passwd']; $login_url =
Update Database
Hi All,I have a problem with this:Code: [Select]<?phpsession_start();include('../common/dbconnect.php');$stock_id = $_GET['stock_id'];$query='SELECT * FROM users_stocks WHERE user_id ="' .
ME54/ME54N Conditional check for Release of PR
Hi Gurus,
post to self
Trying to get my form to submit to itself. However I am also trying to use an image for my submit button, when I set the type='image' it will not submit to itself. Can someone help me figure out