#11 PHP 4.1.2 Compatible (SF.net)

open
nobody
None
5
2004-10-14
2004-10-14
Giorgio Beggiora
No

Hi,

i'd like see Magpie compatible with PHP 4.1.2 so it
will be usable in SouceForge projects' websites.

It's a very easy fix: the only uncompatible function is
"array_change_key_case()" so you can implement it in
this way:

if(!function_exists("array_change_key_case")){
function array_change_key_case($a,$b){
$result=array();
$keys=array_keys($a);
$q=count($k);
if($b=="CASE_LOWER"){
foreach($keys as $K){
$k=strtolower($K);
$result[$k]=$a[$K];
}
}else{
foreach($keys as $k){
$K=strtolower($k);
$result[$K]=$a[$k];
}
}
return result;
}
}

Discussion

  • Logged In: YES
    user_id=563286

    sorry, there was a little error.
    Here the right function:

    if(!function_exists("array_change_key_case")){
    function array_change_key_case($a,$b){
    $result=array();
    $keys=array_keys($a);
    $q=count($k);
    if($b=="CASE_LOWER"){
    foreach($keys as $K){
    $k=strtolower($K);
    $result[$k]=$a[$K];
    }
    }else{
    foreach($keys as $k){
    $K=strtoupper($k);
    $result[$K]=$a[$k];
    }
    }
    return result;
    }
    }