Making function from long script
I have long script. can i make some function with loops or something. 

The code:

    function getPriceP(&$p, &$d, $width){
    	$range = range(79, 155);
    	$range2 = range(156, 234);
    	$width = (int)$width;
    	if(in_array($width, $range)){
    		$p = $p * 0.25 + $p;
    		$d = $d * 0.25 + $d;
    
    	}else if(in_array($width, $range2)){
    		$p = $p * 0.1 + $p;
    		$d = $d * 0.25 + $d;
    	}else{
    		$p = $p;
    		$d = $d;
    	}
    }
    
    if($style == "PAU"){
        if($station == "A"){
            $holder = 85;  
            if($shape == "0"){
               $p = 33;
               $s = 8;
               $d = 16;
               getPriceP($p, $d, $width);
            }else{
               $p = 73;
               $s = 26;
               $d = 40;
    	   getPriceP($p, $d, $width);
    			
            }
        }
        if($station == "B"){
            $holder = 101;  // round = 0
            if($shape == "0"){
               $p = 51;
               $s = 8;
               $d = 16;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 88;
               $s = 26;
               $d = 49;
    		   getPriceP($p, $d, $width);
    
            }
        }
        if($station == "C"){
            $holder = 1065;  // round = 0
            if($shape == "0"){
               $p = 70;
               $s = 28;
               $d = 61;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 119;
               $s = 40;
               $d = 130;
    		   getPriceP($p, $d, $width);
            }
        }
        if($station == "D"){
            $holder = 1371;  // round = 0
            if($shape == "0"){
               $p = 104;
               $s = 36;
               $d = 92;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 171;
               $s = 60;
               $d = 177;
    		   getPriceP($p, $d, $width);
            }
        }
        if($station == "E"){
            $holder = 1572;  // round = 0
            if($shape == "0"){
               $p = 175;
               $s = 57;
               $d = 156;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 245;
               $s = 92;
               $d = 277;
    		   getPriceP($p, $d, $width);
            }
        }
    
    }else if($style == "PAA"){
        if($station == "A"){
            $holder = 85;  // round = 0
            if($shape == "0"){
               $p = 33;
               $s = 8;
               $d = 16;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 73;
               $s = 26;
               $d = 40;
    		   getPriceP($p, $d, $width);
            }
        }
        if($station == "B"){
            $holder = 101;  // round = 0
            if($shape == "0"){
               $p = 51;
               $s = 8;
               $d = 16;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 88;
               $s = 26;
               $d = 49;
    		   getPriceP($p, $d, $width);
            }
        }
        if($station == "C"){
            $holder = 534;  // round = 0
            if($shape == "0"){
               $p = 70;
               $s = 17;
               $d = 61;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 119;
               $s = 34;
               $d = 130;
    		   getPriceP($p, $d, $width);
            }
        }
        if($station == "D"){
            $holder = 722;  // round = 0
            if($shape == "0"){
               $p = 104;
               $s = 24;
               $d = 92;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 171;
               $s = 47;
               $d = 177;
    		   getPriceP($p, $d, $width);
            }
        }
        if($station == "E"){
            $holder = 785;  // round = 0
            if($shape == "0"){
               $p = 175;
               $s = 34;
               $d = 156;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 245;
               $s = 60;
               $d = 277;
    		   getPriceP($p, $d, $width);
            }
        }
    
    }else{
            $holder = 0;
            $p = 0;
            $s = 0;
            $d = 0;
        }
Making function from long script
===

I have long script. can i make some function with loops or something. 

The code:

    function getPriceP(&$p, &$d, $width){
    	$range = range(79, 155);
    	$range2 = range(156, 234);
    	$width = (int)$width;
    	if(in_array($width, $range)){
    		$p = $p * 0.25 + $p;
    		$d = $d * 0.25 + $d;
    
    	}else if(in_array($width, $range2)){
    		$p = $p * 0.1 + $p;
    		$d = $d * 0.25 + $d;
    	}else{
    		$p = $p;
    		$d = $d;
    	}
    }
    
    if($style == "PAU"){
        if($station == "A"){
            $holder = 85;  
            if($shape == "0"){
               $p = 33;
               $s = 8;
               $d = 16;
               getPriceP($p, $d, $width);
            }else{
               $p = 73;
               $s = 26;
               $d = 40;
    	   getPriceP($p, $d, $width);
    			
            }
        }
        if($station == "B"){
            $holder = 101;  // round = 0
            if($shape == "0"){
               $p = 51;
               $s = 8;
               $d = 16;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 88;
               $s = 26;
               $d = 49;
    		   getPriceP($p, $d, $width);
    
            }
        }
        if($station == "C"){
            $holder = 1065;  // round = 0
            if($shape == "0"){
               $p = 70;
               $s = 28;
               $d = 61;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 119;
               $s = 40;
               $d = 130;
    		   getPriceP($p, $d, $width);
            }
        }
        if($station == "D"){
            $holder = 1371;  // round = 0
            if($shape == "0"){
               $p = 104;
               $s = 36;
               $d = 92;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 171;
               $s = 60;
               $d = 177;
    		   getPriceP($p, $d, $width);
            }
        }
        if($station == "E"){
            $holder = 1572;  // round = 0
            if($shape == "0"){
               $p = 175;
               $s = 57;
               $d = 156;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 245;
               $s = 92;
               $d = 277;
    		   getPriceP($p, $d, $width);
            }
        }
    
    }else if($style == "PAA"){
        if($station == "A"){
            $holder = 85;  // round = 0
            if($shape == "0"){
               $p = 33;
               $s = 8;
               $d = 16;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 73;
               $s = 26;
               $d = 40;
    		   getPriceP($p, $d, $width);
            }
        }
        if($station == "B"){
            $holder = 101;  // round = 0
            if($shape == "0"){
               $p = 51;
               $s = 8;
               $d = 16;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 88;
               $s = 26;
               $d = 49;
    		   getPriceP($p, $d, $width);
            }
        }
        if($station == "C"){
            $holder = 534;  // round = 0
            if($shape == "0"){
               $p = 70;
               $s = 17;
               $d = 61;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 119;
               $s = 34;
               $d = 130;
    		   getPriceP($p, $d, $width);
            }
        }
        if($station == "D"){
            $holder = 722;  // round = 0
            if($shape == "0"){
               $p = 104;
               $s = 24;
               $d = 92;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 171;
               $s = 47;
               $d = 177;
    		   getPriceP($p, $d, $width);
            }
        }
        if($station == "E"){
            $holder = 785;  // round = 0
            if($shape == "0"){
               $p = 175;
               $s = 34;
               $d = 156;
    		   getPriceP($p, $d, $width);
            }else{
               $p = 245;
               $s = 60;
               $d = 277;
    		   getPriceP($p, $d, $width);
            }
        }
    
    }else{
            $holder = 0;
            $p = 0;
            $s = 0;
            $d = 0;
        }