FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 10-17-2011, 12:04 PM
Jussi Hirvi
 
Default L9 - what is a value

This code:

var('i') = string;
boolean($i); '<br>';
var('i') = array;
boolean($i); '<br>';

gives:

> false
> true

So an empty array gives "true" but an empty string "false".
This is different from L8. Is this intentional? If so, why?

- Jussi

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-17-2011, 12:57 PM
Jussi Hirvi
 
Default L9 - what is a value

This code:

var('i') = string;
boolean($i); '<br>';
var('i') = array;
boolean($i); '<br>';

gives:

> false
> true

So an empty array gives "true" but an empty string "false".
This is different from L8. Is this intentional? If so, why?

This has consequences which I think are counterintuitive:

var('i') = array(1);
if($i -> find('whatever'));
i 'true'; '<br>';
$i -> find('whatever'); '<br>';
/if;

The if clause evaluates as true and gives as output:
true
array()

- Jussi

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 09:38 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org