Running on a single-cp machine under W2K, this test program
<?php
function show_array ( $s, $a )
{
echo '<table cellspacing="2" cellpadding="2 border="1" >
<tr><td>======& nbsp;' . $s . ' ====== </td></tr>' ;
if ( ! is_array($a) ) { echo '<br>not an array!<br>' ; return ; }
foreach ( $a as $k => $v )
{
echo '<tr>' ;
if ( is_array( $v ) ) show_array( $k, $v ) ;
else echo '<td>' . $k . '</td><td>' . $v . '</td>' ;
echo '</tr>' ;
}
$a = array( 3,4,5 ) ;
$b = array( 30,40,50 ) ;
$c = array( 'foo' => $a, 'bar' => $b ) ;
$d = array( $a, $b ) ;
show_array( 'c', $c ) ;
show_array( 'd', $d ) ;
flush() ;
$x = array_splice( $c['foo'], 1, 1 ) ;
$y = array_splice( $d[0], 1, 1 ) ;
echo 'x is ' . $x[0] . ' and y is ' . $y[0] ;
show_array( 'c', $c ) ;
show_array( 'd', $d ) ;
flush() ;
}
....consistentl y shows the output from the 'x is ... y is' statement
during the output of the *first* call to show_array('d') (specifically
between $d[0] and $d[1]).
I can't imagine what could be going on. This looks like there's an
internal race condition of some kind, which I find very disturbing.
I'm used to serial execution such that the total output of any
subprogram will be queued to the CIO buffer before the output of
statements that follow the subprogram call.
Does anyone know what's going on here? I'm hoping it's something
simple, obvious, and dumb that I'm just not seeing.
TIA,
Margaret
--
(To mail me, please change .not.invalid to .net, first.
Apologies for the inconvenience.)
<?php
function show_array ( $s, $a )
{
echo '<table cellspacing="2" cellpadding="2 border="1" >
<tr><td>======& nbsp;' . $s . ' ====== </td></tr>' ;
if ( ! is_array($a) ) { echo '<br>not an array!<br>' ; return ; }
foreach ( $a as $k => $v )
{
echo '<tr>' ;
if ( is_array( $v ) ) show_array( $k, $v ) ;
else echo '<td>' . $k . '</td><td>' . $v . '</td>' ;
echo '</tr>' ;
}
$a = array( 3,4,5 ) ;
$b = array( 30,40,50 ) ;
$c = array( 'foo' => $a, 'bar' => $b ) ;
$d = array( $a, $b ) ;
show_array( 'c', $c ) ;
show_array( 'd', $d ) ;
flush() ;
$x = array_splice( $c['foo'], 1, 1 ) ;
$y = array_splice( $d[0], 1, 1 ) ;
echo 'x is ' . $x[0] . ' and y is ' . $y[0] ;
show_array( 'c', $c ) ;
show_array( 'd', $d ) ;
flush() ;
}
....consistentl y shows the output from the 'x is ... y is' statement
during the output of the *first* call to show_array('d') (specifically
between $d[0] and $d[1]).
I can't imagine what could be going on. This looks like there's an
internal race condition of some kind, which I find very disturbing.
I'm used to serial execution such that the total output of any
subprogram will be queued to the CIO buffer before the output of
statements that follow the subprogram call.
Does anyone know what's going on here? I'm hoping it's something
simple, obvious, and dumb that I'm just not seeing.
TIA,
Margaret
--
(To mail me, please change .not.invalid to .net, first.
Apologies for the inconvenience.)
Comment