Re: Strings
| From: | Jochem Maas | Date: | Tue, 05 Jun 2007 19:12:25 +0000 |
| Subject: | Re: Strings | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-256126@lists.php.net to get a copy of this message | ||
Pastor Steve wrote:
> Thank you.
>
> I tried what you suggested below and it gave me an unexpected
> T_CONSTANT_ESCAPED_STRING error.
>
> Would this be valid: (I am typing in my Entourage, but I am writing the code
> in Dreamweaver. You are probably seeing the quotes that Entourage (my email
> application) is giving you.)
>
> <?php
>> $image = "";
>> if ($image == NULL) {
>> print "False";
>> } else {
>>
>> ?>
>> <img src="$var">
>> <?
>>
>> }
>>
> ?>
>
> It works if $image is not NULL. However, if it is empty, then it gives me an
$image is never NULL in your example - empty is not exactly the same as NULL,
although NULL is considered empty.
anyway, just for fun chew on this and see if something sticks:
<?php
$image = (mt_rand(0,1) == 0) ? null : "/images/example.jpg";
if (empty($image)) {
echo "False";
} else {
echo '<img src="', $image, '" width="100px"
height="100px" />';
}
?>
> error. I am very much so a novice and appreciate your patience.
okay novice - post the error - even gurus (thats not me) can't mind read. :-