upgrade of php & split deprecated = HELP [message #175024] |
Thu, 04 August 2011 04:38 |
horus
Messages: 2 Registered: August 2011
Karma:
|
Junior Member |
|
|
explode & preg_split produces:
Undefined offset: 2 in /var/www/html/testing/blah/blah/aitoff.php on line
16, referer: httpd://blah.blah.blah/
Undefined offset: 1 in /var/www/html/testing/blah/blah/aitoff.php on line
16, referer: httpd://blah.blah.blah/
here's the code(i've tried the preg_split, & explode):
<?php
class AstronomicalObject{
var $ra;
var $dec;
var $minBrightness;
var $maxBrightness;
function AstronomicalObject($raIn = "00:00:00.000",
$decIn = "00:00:00.000", $maxBrightness = "0",
$minBrightness = "30"){
// Initiate varibles
$this->ra = array("hours" => 0, "minutes" => 0, "seconds" =>
0);
$this->dec = array("degrees" => 0, "minutes" => 0, "seconds"
=> 0);
// convert strings to numbers
list($this->ra["hours"], $this->ra["minutes"],
$this->ra["seconds"]) =
split('[\ :]', $raIn);
$temp = split('[\ :]', $decIn);
if(count($temp) == 2){
list($this->dec["degrees"], $this->dec["minutes"]) =
$temp;
}elseif(count($temp) == 3){
list($this->dec["degrees"], $this->dec["minutes"],
$this->dec["seconds"]) = $temp;
}
$this->minBrightness = $minBrightness;
$this->maxBrightness = $maxBrightness;
}
thanks ahead of time
dmc
|
|
|