[PHP-BUG] Req #63577 [NEW]: Array invert or Array transpose (two dimensional)

2012-11-21 Thread tagg_maiwald at yahoo dot com
From: tagg_maiwald at yahoo dot com
Operating system: 
PHP version:  Irrelevant
Package:  Arrays related
Bug Type: Feature/Change Request
Bug description:Array invert or Array transpose (two dimensional)

Description:

Two dimensional array inversion or transposition task is granular enough
that it should be included as a PHP array_(name) function, instead of
forcing scripters to re-invent the wheel.

array_invert and array_transpose are two names which seem natural for
this.

Test script:
---
?php
function f_ary_trans_rc( $ary )
{
$ret_ary = Array( ) ;

foreach( $ary as $k_row = $ary_col )
{   foreach( $ary_col as $k_col = $v_node )
{   $ret_ary[ $k_col ][ $k_row ] = $v_node ;
}   }

return $ret_ary ;
}

function f_ary_out( $ary )
{
$sz_ret = '' ;
foreach( $ary as $k_row = $ary_col )
{   foreach( $ary_col as $k_col = $v_node )
{   $sz_ret .= $v_node ;
}
$sz_ret .= \n ;
}

return $sz_ret ;
}

$ary_test = Array
(   'abc',
'def',
'ghi',
'123',
'456',
'789'
) ;

$ary_before = Array( ) ;

foreach( $ary_test as $key = $value )
{   
$value = trim( $value ) ;
$value = strtoupper( $value ) ;
$ary_before[ ] = str_split( $value ) ;
}

echo '$ary_before:' . \n ;
echo f_ary_out( $ary_before ) ;
print_r( $ary_before ) ;


$ary_after = f_ary_trans_rc( $ary_before ) ;

echo \n\n . '$ary_after:' . \n ;
echo f_ary_out( $ary_after ) ;
print_r( $ary_after ) ;
?

Expected result:

Row and column indices of the returned array will be inverted/transposed
from that of the parameter array, with corresponding movement of the
referenced nodes/values.

Actual result:
--
$ary_before:
ABC
DEF
GHI
123
456
789
Array
(
[0] = Array
(
[0] = A
[1] = B
[2] = C
)

[1] = Array
(
[0] = D
[1] = E
[2] = F
)

[2] = Array
(
[0] = G
[1] = H
[2] = I
)

[3] = Array
(
[0] = 1
[1] = 2
[2] = 3
)

[4] = Array
(
[0] = 4
[1] = 5
[2] = 6
)

[5] = Array
(
[0] = 7
[1] = 8
[2] = 9
)

)


$ary_after:
ADG147
BEH258
CFI369
Array
(
[0] = Array
(
[0] = A
[1] = D
[2] = G
[3] = 1
[4] = 4
[5] = 7
)

[1] = Array
(
[0] = B
[1] = E
[2] = H
[3] = 2
[4] = 5
[5] = 8
)

[2] = Array
(
[0] = C
[1] = F
[2] = I
[3] = 3
[4] = 6
[5] = 9
)

)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63577edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63577r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63577r=trysnapshot53
Try a snapshot (trunk): 
https://bugs.php.net/fix.php?id=63577r=trysnapshottrunk
Fixed in SVN:   https://bugs.php.net/fix.php?id=63577r=fixed
Fixed in release:   https://bugs.php.net/fix.php?id=63577r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63577r=needtrace
Need Reproduce Script:  https://bugs.php.net/fix.php?id=63577r=needscript
Try newer version:  https://bugs.php.net/fix.php?id=63577r=oldversion
Not developer issue:https://bugs.php.net/fix.php?id=63577r=support
Expected behavior:  https://bugs.php.net/fix.php?id=63577r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63577r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63577r=submittedtwice
register_globals:   https://bugs.php.net/fix.php?id=63577r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63577r=php4
Daylight Savings:   https://bugs.php.net/fix.php?id=63577r=dst
IIS Stability:  https://bugs.php.net/fix.php?id=63577r=isapi
Install GNU Sed:https://bugs.php.net/fix.php?id=63577r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63577r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63577r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63577r=mysqlcfg



#26273 [Bgs]: conditional concatenator

2003-11-17 Thread tagg_maiwald at yahoo dot com
 ID:   26273
 User updated by:  tagg_maiwald at yahoo dot com
 Reported By:  tagg_maiwald at yahoo dot com
 Status:   Bogus
 Bug Type: Feature/Change Request
 Operating System: Windows 98
 PHP Version:  4.3.4
 New Comment:

Sorry. Need more sleep.


Previous Comments:


[2003-11-17 16:50:45] [EMAIL PROTECTED]

How is this any different from the already-implemented 
ternary operator? 
 
$sz_string .= ($bool_test) ? 'bar' : 'baz'; 
 
J 



[2003-11-16 10:04:14] tagg_maiwald at yahoo dot com

Description:

A conditional concatenator would evaluate a boolean test, then
concatenate a value onto the left operand. This operator would simplify
scripts by eliminating a kludge. The motive behind this request is to
readily construct SQL queries via PHP which can be easily reread and
understood with minimal confusion by a follow-on person maintaining the
script(s).

Reproduce code:
---
// kludge
$sz_string = 'foo';
if ($bool_test) { $sz_string .= 'bar'; }
else { $sz_string .= 'baz'; }
echo $sz_string

// conditional concatenator
$sz_string = 'foo';
$sz_string .? ($bool_test) 'bar' : 'baz';
echo $sz_string

Expected result:

foobar

Actual result:
--
foobar





-- 
Edit this bug report at http://bugs.php.net/?id=26273edit=1


#26273 [NEW]: conditional concatenator

2003-11-16 Thread tagg_maiwald at yahoo dot com
From: tagg_maiwald at yahoo dot com
Operating system: Windows 98
PHP version:  4.3.4
PHP Bug Type: Feature/Change Request
Bug description:  conditional concatenator

Description:

A conditional concatenator would evaluate a boolean test, then concatenate
a value onto the left operand. This operator would simplify scripts by
eliminating a kludge. The motive behind this request is to readily
construct SQL queries via PHP which can be easily reread and understood
with minimal confusion by a follow-on person maintaining the script(s).

Reproduce code:
---
// kludge
$sz_string = 'foo';
if ($bool_test) { $sz_string .= 'bar'; }
else { $sz_string .= 'baz'; }
echo $sz_string

// conditional concatenator
$sz_string = 'foo';
$sz_string .? ($bool_test) 'bar' : 'baz';
echo $sz_string

Expected result:

foobar

Actual result:
--
foobar

-- 
Edit bug report at http://bugs.php.net/?id=26273edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26273r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26273r=trysnapshot5
Fixed in CVS:   http://bugs.php.net/fix.php?id=26273r=fixedcvs
Fixed in release:   http://bugs.php.net/fix.php?id=26273r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26273r=needtrace
Try newer version:  http://bugs.php.net/fix.php?id=26273r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=26273r=support
Expected behavior:  http://bugs.php.net/fix.php?id=26273r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=26273r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=26273r=submittedtwice
register_globals:   http://bugs.php.net/fix.php?id=26273r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26273r=php3
Daylight Savings:   http://bugs.php.net/fix.php?id=26273r=dst
IIS Stability:  http://bugs.php.net/fix.php?id=26273r=isapi
Install GNU Sed:http://bugs.php.net/fix.php?id=26273r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26273r=float


#24747 [Bgs]: Fatal error: Call to undefined function: stripos()

2003-07-22 Thread tagg_maiwald at yahoo dot com
 ID:   24747
 User updated by:  tagg_maiwald at yahoo dot com
 Reported By:  tagg_maiwald at yahoo dot com
 Status:   Bogus
 Bug Type: Strings related
 Operating System: Win 98
 PHP Version:  4.3.2
 New Comment:

The stripos() function, documented as cvs 5.0, works just fine in 4.3.1
and 4.3.2 when the provided haystack is not an empty string.


Previous Comments:


[2003-07-21 21:34:21] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

stripos is only available in php5.



[2003-07-21 21:26:55] tagg_maiwald at yahoo dot com

Description:

When a string-returning-function or empty string variable is provided
as the haystack, PHP reports Fatal error: Call to undefined function:
stripos().

Reproduce code:
---
if ((1strlen(mysql_error()))(stripos(mysql_error(), duplicate)))
{ echo is a duplicate record error;
}

Expected result:

The (stripos(mysql_error(), duplicate))) sub-boolean should evaluate
to FALSE or some integer.

Actual result:
--
Fatal error: Call to undefined function: stripos()





-- 
Edit this bug report at http://bugs.php.net/?id=24747edit=1



#24747 [NEW]: Fatal error: Call to undefined function: stripos()

2003-07-21 Thread tagg_maiwald at yahoo dot com
From: tagg_maiwald at yahoo dot com
Operating system: Win 98
PHP version:  4.3.2
PHP Bug Type: Strings related
Bug description:  Fatal error: Call to undefined function: stripos()

Description:

When a string-returning-function or empty string variable is provided as
the haystack, PHP reports Fatal error: Call to undefined function:
stripos().

Reproduce code:
---
if ((1strlen(mysql_error()))(stripos(mysql_error(), duplicate)))
{ echo is a duplicate record error;
}

Expected result:

The (stripos(mysql_error(), duplicate))) sub-boolean should evaluate to
FALSE or some integer.

Actual result:
--
Fatal error: Call to undefined function: stripos()

-- 
Edit bug report at http://bugs.php.net/?id=24747edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24747r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24747r=trysnapshot5
Fixed in CVS:   http://bugs.php.net/fix.php?id=24747r=fixedcvs
Fixed in release:   http://bugs.php.net/fix.php?id=24747r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24747r=needtrace
Try newer version:  http://bugs.php.net/fix.php?id=24747r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=24747r=support
Expected behavior:  http://bugs.php.net/fix.php?id=24747r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=24747r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=24747r=submittedtwice
register_globals:   http://bugs.php.net/fix.php?id=24747r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24747r=php3
Daylight Savings:   http://bugs.php.net/fix.php?id=24747r=dst
IIS Stability:  http://bugs.php.net/fix.php?id=24747r=isapi
Install GNU Sed:http://bugs.php.net/fix.php?id=24747r=gnused