Hi there,

On Thu, 2003-07-10 at 21:53, Phil Powell wrote:
> foreach ($profileArray[$i][attributes] as $key => $val) {
                             ^^^^^^^^^^
You should quote the word 'attributes':

http://www.php.net/manual/en/language.types.array.php#language.types.array.donts

Sorry...that link might wrap. Anyway, I doubt that's the problem...

>      $singleProfileHTML .= $key . "=\"" . str_replace("'", ''', 
> str_replace('"', '"', $val)) . "\"\n";
>     }

No idea. All I did was copy-paste your code and add a test definition
for the other vars, and I just got this:

[Script]
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('html_errors', true);

$profileArray = 
array('1' => 
      array('attributes' =>
            array('height' => '"168" cm',
                  'weight' => '\'65\' kg')));

$singleProfileHTML = '';
$i = 1;

foreach ($profileArray[$i][attributes] as $key => $val) {
    $singleProfileHTML .= $key . "=\"" . str_replace("'", '&#039;',
str_replace('"', '&quot;', $val)) . "\"\n";
}

print_r($singleProfileHTML);
?>

[Output]
Notice:  Use of undefined constant attributes - assumed 'attributes' in 
/home/torben/public_html/phptest/__phplist.html on line 36

height=""168" cm"
weight="'65' kg"

> The parsing error occurs in the "$singleProfileHTML.." line.  I'm
>  completely don't get it; I see absolutely nothing wrong with this,
>  what did I miss?
>
> Phil

I don't see anything wrong. Perhaps you have a non-printable control
character embedded in your code? Try copy-pasting the above code (but
quote that array key) and see if that helps. Also, check the code
before that line for unclosed quotes and braces/parens or other
problems; some parse errors can show up far from where they actually
occurred.

Other than that, without knowing anything else, it's hard to say off the
top of my head.


-- 
 Torben Wilson <[EMAIL PROTECTED]>                        +1.604.709.0506
 http://www.thebuttlesschaps.com          http://www.inflatableeye.com
 http://www.hybrid17.com                  http://www.themainonmain.com
 -----==== Boycott Starbucks!  http://www.haidabuckscafe.com ====-----




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

Reply via email to