Re: Strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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. :-

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux