I trying to read a file to an array of objects. The problem is if try to print out the array $arrCall nothing shows up. Even if I put it in a loop I don't get anything
This is the object with the class name Calls
<?php
class Calls {
//Set accessor mehtods
function __get($property)
{
if (array_key_exists($property, $this->arr)) {
return $this->arr[$property];
} else {
print "Error: Can't read a property other than x & y\n";
}
}
function __set($property, $value)
{
if (array_key_exists($property, $this->arr)) {
$this->arr[$property] = $value;
} else {
print "Error: Can't write a property other than x & y\n";
}
}
/*
* Format a string into a date object using a regular expression
*/
public function formatDate($myData )
{
$theDate = ereg_replace("[^0-9]", '', $myData);
if(strlen($theDate) != 8)
return (False);
$day = substr($theDate,0,2);
$month = substr($theDate,2,2);
$year = substr($theDate,4,8);
$goDate = $day."/".$month."/".$year;
return date("m-d-Y", strtotime($goDate)) ;
}
/*
* Format a string into a user friendly phone number using a regular expression
*/
function formatphone($tPhone)
{
$sPhone = ereg_replace("[^0-9]",'',$tPhone);
if(strlen($sPhone) != 10) return(False);
$sArea = substr($sPhone,0,3);
$sPrefix = substr($sPhone,3,3);
$sNumber = substr($sPhone,6,4);
$sPhone = "(".$sArea.")".$sPrefix."-".$sNumber;
return($sPhone);
}
/*
* Calculate the duration of a phone call from seconds to minutes
*/
function formatDuration($fDuration)
{
$myMin = $fDuration/60;
return $myMin;
}
/*
* Format a string into a date object using a regular expression
*/
public function formatTime($myTime )
{
return date("H:i:s", strtotime($myTime)) ;
}
/*
* Calculate the cost of a phone call whether it is a local or long distance call.
* The rate of the type of call could be inputed by user
*/
Bookmarks