[ create a new paste ] login | about

Link: http://codepad.org/ARzh7ya9    [ raw code | fork ]

PHP, pasted on Jul 25:
<?php
        /* 
	    Function calCost: calculate the cost of the calls
	*/
	private function calCost() {

		foreach($this->callArr as $callRaw)
		{
			
			$callRaw 	= explode(':', $callRaw);
			$call 		= substr($callRaw[0], 2);
			$call 		= substr($call, 0, 2);
			$duration	= $callRaw[1];

			foreach($this->priceArr as $priceRaw)
			{
			
				# explode raw price
				$priceRaw = explode(':', $priceRaw);
				
				# define new variables
					# [0] = number
					# [1] = price
					# [2] = type
					# [3] = oa

				if(!(strlen($priceRaw[0]) == 2))
				{
					$number = substr($priceRaw[0], 2);
				} else {
					$number = $priceRaw[0];
				}

				$price 	= $priceRaw[1];
				$type	= $priceRaw[2];
				$oa	= $priceRaw[3];
			
				
				
				# if match found
				if($number == $call)
				{
				
					$this->doCalc($number, $call, $price, $type, $oa, $duration);
					break;
					
				}
			
			}
			
		}
	
	}

?>


Create a new paste based on this one


Comments: