Of course, you could do it in a much more cryptic way... just for fun.

:-)

INPUT:

<?php

$a = array( '0' => 'j',
            'fname' => 'j',
            '1' => 'j',
            'lname' => 'j',
            '2' => 'jj',
            'state' => '',
            '3' => '[EMAIL PROTECTED]',
            'email' => '[EMAIL PROTECTED]',
            '4' => '0',
            'newsletter' => '0',
                );

array_walk($a, create_function('&$v', '$v = ($v=="")?"&nbsp;":$v;'));
print_r($a);

?>

OUTPUT:

[EMAIL PROTECTED] php -f test.php
Array
(
    [0] => j
    [fname] => j
    [1] => j
    [lname] => j
    [2] => jj
    [state] => &nbsp;
    [3] => [EMAIL PROTECTED]
    [email] => [EMAIL PROTECTED]
    [4] => 0
    [newsletter] => 0
)

Chris W. Parker wrote:
Hey people.

I've got an array like this:


[0] => Array ( [0] => j [fname] => j [1] => j [lname] => j [2] => jj [state] => jj [3] => [EMAIL PROTECTED] [email] => [EMAIL PROTECTED] [4] => 0 [newsletter] => 0 )

Some cells might be empty so i want to replace every empty cell with
"&nbsp;". I can easily do this with just the numerical index but I can't
figure out how to do the textual indices also.

Someone have a clue?


Thanks, Chris.


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to