// hack, must make global as uksort() won't
// allow us to pass any other auxiliary information
uksort($agesorter_arr, 'agesorter_compare');
- while (list($key, $val) = each($agesorter_arr)) {
+ foreach($agesorter_arr as $key => $val) {
// recreate each struct element
$v[] = new Value(
array(
//if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
//{
$ar = $o->me;
- reset($ar);
- list($typ, $val) = each($ar);
+ $val = reset($ar);
+ $typ = key($ar);
return '<value>' . $this->serializedata($typ, $val) . "</value>\n";
//}
public function getval()
{
// UNSTABLE
- reset($this->me);
- list($a, $b) = each($this->me);
+ $b = reset($this->me);
+ $a = key($this->me);
// contributed by I Sofer, 2001-03-24
// add support for nested arrays to scalarval
// i've created a new method here, so as to
// preserve back compatibility
if (is_array($b)) {
- @reset($b);
- while (list($id, $cont) = @each($b)) {
+ foreach($b as $id => $cont) {
$b[$id] = $cont->scalarval();
}
}
// add support for structures directly encoding php objects
if (is_object($b)) {
$t = get_object_vars($b);
- @reset($t);
- while (list($id, $cont) = @each($t)) {
+ foreach($t as $id => $cont) { {
$t[$id] = $cont->scalarval();
}
- @reset($t);
- while (list($id, $cont) = @each($t)) {
+ foreach($t as $id => $cont) {
@$b->$id = $cont;
}
}
switch ($xmlrpcVal->kindOf()) {
case 'scalar':
if (in_array('extension_api', $options)) {
- reset($xmlrpcVal->me);
- list($typ, $val) = each($xmlrpcVal->me);
+ $val = reset($xmlrpcVal->me);
+ $typ = key($xmlrpcVal->me);
switch ($typ) {
case 'dateTime.iso8601':
$xmlrpcVal->scalar = $val;
$xmlrpcVal = new Value($phpVal->format('Ymd\TH:i:s'), Value::$xmlrpcStruct);
} else {
$arr = array();
- reset($phpVal);
- while (list($k, $v) = each($phpVal)) {
+ foreach($phpVal as $k => $v) {
$arr[$k] = $this->encode($v, $options);
}
$xmlrpcVal = new Value($arr, Value::$xmlrpcStruct);
}
// be tolerant to line endings, and extra empty lines
$ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos)));
- while (list(, $line) = @each($ar)) {
+ foreach($ar as $line) {
// take care of multi-line headers and cookies
$arr = explode(':', $line, 2);
if (count($arr) > 1) {
*/
public function serialize($charsetEncoding = '')
{
- reset($this->me);
- list($typ, $val) = each($this->me);
+ $val = reset($this->me);
+ $typ = key($this->me);
return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n";
}
*/
public function scalarval()
{
- reset($this->me);
- list(, $b) = each($this->me);
+ $b = reset($this->me);
return $b;
}
public function scalartyp()
{
reset($this->me);
- list($a,) = each($this->me);
+ $a = key($this->me);
if ($a == static::$xmlrpcI4) {
$a = static::$xmlrpcInt;
}
case 1:
// todo: handle i4 vs int
reset($this->me);
- list($type,) = each($this->me);
+ $type = key($this->me);
if ($type != $offset) {
throw new \Exception('');
}
return isset($this->me['array'][$offset]) ? $this->me['array'][$offset] : null;
case 1:
// on bad type: null or exception?
- reset($this->me);
- list($type, $value) = each($this->me);
+ $value = reset($this->me);
+ $type = key($this->me);
return $type == $offset ? $value : null;
default:
// return null or exception?
$got = '';
$expected = '37210';
$expect_array = array('ctLeftAngleBrackets', 'ctRightAngleBrackets', 'ctAmpersands', 'ctApostrophes', 'ctQuotes');
- while (list(, $val) = each($expect_array)) {
+ foreach($expect_array as $val) {
$b = $v->structmem($val);
$got .= $b->me['int'];
}