Re: Coding Question

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

 



If I'm not mistaken Al wanted to return something if the thing failed,
without having to put it inside an if_block.

I'm watching this with curiosity, because return is a language
construct, and not a function, or anything that has a value.

I could probably have said that better sober, and not at 06:16am, but
hopefully  you get my drift.

On Mon, 06 Dec 2004 09:11:26 +1000, Ligaya Turmelle <lig@xxxxxxxx> wrote:
> <snip>
>  > $db_link= mysql_connect($host, $user, $pw)
>  >        OR die("Could not connect: " . mysql_error());
> </snip>
> 
> try:
> $db_link= mysql_connect($host, $user, $pw);
> if (!$db_link){
>     // do whatever if there is something wrong
> }
> 
> maybe try something like that with the file_get_contents also?
> 
> Respectfully,
> Ligaya Turmelle
> 
> ---
> Life is a game... so have fun.
> ---
> www.PHPCommunity.org
> Open Source, Open Community
> Visit for more information or to join the movement
> 
> 
> 
> 
> Al wrote:
> > I've searched the PHP manual and can't find an answer for this question
> >
> > I'd like to use the "OR DIE" construct; but instead of "DIE" I'd like to
> > use "RETURN FOO". I haven't found a way to do it.
> >
> >
> > $string= file_get_contents($filename)
> >     OR die("Could not read file");
> >
> > $db_link= mysql_connect($host, $user, $pw)
> >        OR die("Could not connect: " . mysql_error());
> >
> > Seems like it would be nice to not have to test first, e.g.,
> > if(is_readable($filename)){.... }
> >
> > Thanks....
> >
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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