Hi,
I am running a self-compiled PHP version 4.4.2 on Apache 1.3.34 on White Box
Enterprise Linux 3.
I found a problem in my database access code (Oracle 9.2.0.4 if it matters)
and have determined that spaces in string variables are being compacted on
output in PHP.
This PHP extract, when run, illustrates the problem:
<?php
$name = "Space 9";
print "<p>Length: ".strlen($name);
printf("<p>Variable: %s",$name);
print "<p>Variable: '".$name."'";
echo "<p>Variable: ".$name;
for($i=0; $i< strlen($name); $i++)
print "<p>Character: ".$i."\"$name[$i]\"";
?>
even though the string does contain 9 consecutive spaces, only one is ever
printed to the screen with echo, print or printf. There is nothing in the
documentation for these functions that I've found that says this is the
expected behavior, or how to override if one really wants those spaces
honored.
Why is this important? Well, the application this is in allows users to define
text strings that are inserted into the database with multiple consecutive
spaces, however, when constructing select lists in PHP using these same
entries the spaces are compacted, so the SELECT now doesn't match what is in
the database.
Is there a way to override this behavior?
Thanks,
Geoff Quelch
--
Geoff Quelch
Email: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php