Jump to content

Archived

This topic is now archived and is closed to further replies.

Techmaster

The 0 (Zero) Value being omitted

Recommended Posts

I have simple scripts that handle int values and for some reason the 0 (Zero) are being ommited
Value is --none--

[code]
if($settings[border]=="--none--") $border = "0";
else $border = $settings[border];
[/code]

prints null or nothing

Another Example

[code]
$border = range(0,10);
[/code]
The array ommits the 0 (Zero)
Any Ideas

Share this post


Link to post
Share on other sites
I ran your second bit, which seems to work correclty. Here's the result and how I displayed it:
Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 [6] => 6 [7] => 7 [8] => 8 [9] => 9 [10] => 10 )

[code]<?
$border = range(0,10);
print_r($border);
?>[/code]

Likewise, I tried your first bit of code, print_r the result and got:
Array ( [border] => --none-- ) 0

[code]<?
$settings[border]="--none--";
if($settings[border]=="--none--") $border = "0";
else $border = $settings[border];
print_r($settings);
print_r($border);
?>[/code]

Share this post


Link to post
Share on other sites
[quote name='michaellunsford' date='Mar 8 2006, 11:44 PM' post='353139']
I ran your second bit, which seems to work correclty. Here's the result and how I displayed it:
Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 [6] => 6 [7] => 7 [8] => 8 [9] => 9 [10] => 10 )

[code]<?
$border = range(0,10);
print_r($border);
?>[/code]

Thanks you post let me find the error the settings was declared after the if statment (working to long)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.