Fatal error: Call to undefined method DateTime::diff() - php

When my code is moved from local server to live server it shows an error like this :
Fatal error: Call to undefined method DateTime::diff()
Code:
<?php
date_default_timezone_set('Asia/Calcutta');
$sFinalDate = date('Y-m-d', strtotime($sDate));
$sNow = new DateTime();
$iRemain = new DateTime( $sFinalDate.$sTime);
$iInterval = $iRemain->diff($sNow);
$sTimeCounter = $iInterval->format("%h: %i :%s ");
$sCalculate = $iInterval->format("%a:%h:%i");
?>

Though I found a number of people who ran into the issue of 5.2 and
lower not supporting this function, I was unable to find any solid
examples to get around it. Therefore I hope this can help some others:
<?php
function get_timespan_string($older, $newer) {
$Y1 = $older->format('Y');
$Y2 = $newer->format('Y');
$Y = $Y2 - $Y1;
$m1 = $older->format('m');
$m2 = $newer->format('m');
$m = $m2 - $m1;
$d1 = $older->format('d');
$d2 = $newer->format('d');
$d = $d2 - $d1;
$H1 = $older->format('H');
$H2 = $newer->format('H');
$H = $H2 - $H1;
$i1 = $older->format('i');
$i2 = $newer->format('i');
$i = $i2 - $i1;
$s1 = $older->format('s');
$s2 = $newer->format('s');
$s = $s2 - $s1;
if($s < 0) {
$i = $i -1;
$s = $s + 60;
}
if($i < 0) {
$H = $H - 1;
$i = $i + 60;
}
if($H < 0) {
$d = $d - 1;
$H = $H + 24;
}
if($d < 0) {
$m = $m - 1;
$d = $d + get_days_for_previous_month($m2, $Y2);
}
if($m < 0) {
$Y = $Y - 1;
$m = $m + 12;
}
$timespan_string = create_timespan_string($Y, $m, $d, $H, $i, $s);
return $timespan_string;
}
function get_days_for_previous_month($current_month, $current_year) {
$previous_month = $current_month - 1;
if($current_month == 1) {
$current_year = $current_year - 1; //going from January to previous December
$previous_month = 12;
}
if($previous_month == 11 || $previous_month == 9 || $previous_month == 6 || $previous_month == 4) {
return 30;
}
else if($previous_month == 2) {
if(($current_year % 4) == 0) { //remainder 0 for leap years
return 29;
}
else {
return 28;
}
}
else {
return 31;
}
}
function create_timespan_string($Y, $m, $d, $H, $i, $s)
{
$timespan_string = '';
$found_first_diff = false;
if($Y >= 1) {
$found_first_diff = true;
$timespan_string .= pluralize($Y, 'year').' ';
}
if($m >= 1 || $found_first_diff) {
$found_first_diff = true;
$timespan_string .= pluralize($m, 'month').' ';
}
if($d >= 1 || $found_first_diff) {
$found_first_diff = true;
$timespan_string .= pluralize($d, 'day').' ';
}
if($H >= 1 || $found_first_diff) {
$found_first_diff = true;
$timespan_string .= pluralize($H, 'hour').' ';
}
if($i >= 1 || $found_first_diff) {
$found_first_diff = true;
$timespan_string .= pluralize($i, 'minute').' ';
}
if($found_first_diff) {
$timespan_string .= 'and ';
}
$timespan_string .= pluralize($s, 'second');
return $timespan_string;
}
function pluralize( $count, $text )
{
return $count . ( ( $count == 1 ) ? ( " $text" ) : ( " ${text}s" ) );
}
?>
source http://php.net/manual/en/function.date-diff.php
if you using php 5.3 then there would be another issue
working above example on php>=5.3

Related

Why does this code take a long time to execute?

I would appreciate some guidance on the following issue. I am by no means an expert in php. The code below takes almost 10 seconds to execute! Is there anything I am doing that is wrong or bad practice?
$data = [];
$today = date("Y/m/d");
$ThisYear = Date('Y'); //get current Year
$ThisMonth = Date('m'); //get current month
$Tday = '01'; //first day of month
$Tmonth = '09'; //September
if (8 < $ThisMonth && $ThisMonth < 13) {
$AcYear = $ThisYear; }
else {
$AcYear = $ThisYear - 1; // sets start of academic year to be last year
}
$AcFullYear = $AcYear.'/'.$Tmonth.'/'.$Tday;
//find rank in all school
$students_rank = [];
$school_id = Student::model()->findByAttributes(['user_master_id' => Yii::app()->user->id])->school_master_id;
$criteria1 = new CDbCriteria;
$criteria1->with = array('user');
$criteria1->condition = "t.school_master_id=:school_master AND user.status ='1'";
$criteria1->params = array(':school_master' => $school_id);
$school_students_details = Student::model()->findAll($criteria1);
foreach ($school_students_details as $key => $value) {
$student_name = StudentDetails::model()->findByAttributes(['user_master_id' => $value->user_master_id]); //student details with year group
$criteria2 = new CDbCriteria;
$criteria2->with = array('homeworkMaster');
$criteria2->condition = "t.student_id=:student_id AND homeworkMaster.question_type_id<>:question_type_id";
$criteria2->params = array(':student_id' => $value->user_master_id, ':question_type_id' => 6);
$HW_assignment_track = HomeworkAssignmentTrack::model()->findAll($criteria2);
$total_HW = count((array)$HW_assignment_track);
$student_score = 0;
$student_rank = 0;
$student_total_score = 0;
$total_HW_marks = 0;
$under_deadline_HW = 0;
$criteria3 = new CDbCriteria();
$criteria3->condition = "student_id =:student_id AND status=:status AND created_at >= '$AcFullYear' AND created_at <= '$today'";
$criteria3->params = [':student_id' => $value->user_master_id, ':status' => 2];
$student_completed_HW = HomeworkStudentAnswere::model()->findAll($criteria3);
$i = 1;
foreach ($student_completed_HW as $s_c_h_K => $s_c_h_V) {
if ($s_c_h_V->homework->homework_type == 2) {
$total_HW -= 1;
} elseif ($s_c_h_V->homework->homework_type == 1) {
$HW_questions = HomeworkQuestion::model()->findAllByAttributes(['homework_master_id' => $s_c_h_V->homework_id, 'status' => 1]);
foreach ($HW_questions as $qKey => $qVal) {
if ($qVal->question_type_id ==3) {
$total_HW_marks += 2;
} else {
$total_HW_marks += $qVal->marks;
}
}
$assignment = HomeworkAssignmentTrack::model()->findByAttributes(['id' => $s_c_h_V->assignment_track_id]);
$homeworks_within_validate = Assignment::model()->findByPk($assignment->assignment_id);
if ($homeworks_within_validate->valid_date === '0' && $homeworks_within_validate->deadline >= date('Y-m-d')) {
$total_HW -= 1;
}
if ($homeworks_within_validate->valid_date === '1' || (($homeworks_within_validate->valid_date === '0') && ($homeworks_within_validate->deadline >= date('Y-m-d', strtotime($s_c_h_V->created_at))) && ($homeworks_within_validate->deadline < date('Y-m-d')))) {
if ($s_c_h_V->review_status === '2') {
$student_total_score += $s_c_h_V->score;
}
}
$homework_submit = HomeworkCompleteNotification::model()->findByAttributes(['homework_id' => $s_c_h_V->homework_id, 'assignment_track_id' => $s_c_h_V->assignment_track_id, 'student_id' => $value->user_master_id]);
if (($homeworks_within_validate->valid_date === '0') && ($homeworks_within_validate->deadline >= date('Y-m-d', strtotime($homework_submit->created_at))) && ($s_c_h_V->review_status === '2')) {
$under_deadline_HW += 10;
}
if ($total_HW_marks !=0) {
$student_score += round(($student_total_score / $total_HW_marks) * 100);
} else {
$student_score = 0;
}
}
$i += 1;
}
//add revision scores to rank score
$criteria4 = new CDbCriteria();
$criteria4->condition = "user_id =:user_id AND date_created >= '$AcFullYear' AND date_created <= '$today'";
$criteria4->params = [':user_id' => $value->user_master_id];
$revision_score = RevisionScores::model()->findAll($criteria4);
$sum = 0;
foreach($revision_score as $item) {
$sum += $item['score'];
} //end of adding revision scores
$students_rank[$key]['student_id'] = $value->user_master_id;
$students_rank[$key]['year_group'] = $student_name->year_group_id; //added year group to model array
if ($student_score > 0) {
$student_rank += round($student_score / $total_HW, 0) + $under_deadline_HW;
$students_rank[$key]['rank'] = $student_rank + $sum;
} else {
$students_rank[$key]['rank'] = $sum;
}
}
$model = $this->multid_sort($students_rank, 'rank');
$rank_score = round(array_column($model, 'rank', 'student_id')[Yii::app()->user->id],0);
$year_rank =[];
$current_st = StudentDetails::model()->findByAttributes(['user_master_id' => Yii::app()->user->id]);
$current_st_year = $current_st->year_group_id;
$rank_list = [];
foreach ($model as $key => $value) {
$rank_list[] = $value['student_id'];
if ($value['year_group'] == $current_st_year) {
$year_rank[] = $value['student_id'];
}
}
$user = Yii::app()->user->id;
$sch_position = array_search($user,$rank_list);
$yr_position = array_search($user,$year_rank);
$final_rank = $sch_position + 1;
$yr_rank = $yr_position + 1;
$sch_rank = $final_rank;
$ends = array('th','st','nd','rd','th','th','th','th','th','th');
if (($sch_rank %100) >= 11 && ($sch_rank%100) <= 13) {
$sc_abbreviation = 'th';
$yr_abbreviation = 'th';
} else {
$sc_abbreviation = $ends[$sch_rank % 10];
$yr_abbreviation = $ends[$yr_rank % 10];
}
$models = UserMaster::model()->findByPk(Yii::app()->user->id);
$year_name = $models->studentDetails->yearGroup->name;
$data['type'] = 'success';
$data['score'] = '<div>Ranking Score: '.$rank_score.'</div>';
$data['yr_rank'] = '<div><i class="fa fa-trophy rank-i"></i><span class="rank-number">' .$yr_rank. '</span><sup class="script-top" id="year_rank_abb">' .$yr_abbreviation. '</sup></div><div id="year_name">In ' .$year_name. '</div>';
$data['school_rank'] = '<div><i class="fa fa-trophy rank-i"></i><span class="rank-number">' .$sch_rank. '</span><sup class="script-top" id="year_rank_abb">' .$sc_abbreviation. '</sup></div><div id="year_name">In School</div>';
$data['rank_revise'] ='<div>'.$rank_score.'</div>';
$data['yr_rank_revise'] = '<span>'.$yr_rank.'</span><sup class="superscript" style="left:0">'.$yr_abbreviation.'</sup>';
$data['sch_rank_revise'] = '<span>'.$sch_rank.'</span><sup class="superscript" style="left:0">'.$sc_abbreviation.'</sup>';
$_SESSION['rank'] = $rank_score;
$_SESSION['accuracy'] = $rank_score;
echo json_encode($data);
exit;
The above is used in an Yii application. It runs perfectly fine on localhost, but on live site, takes over 10 seconds to execute.
Your help and guidance is appreciated.
Thank

Fatal error : Using $this when not in object context in [duplicate]

This question already has answers here:
PHP Fatal error: Using $this when not in object context
(9 answers)
Closed 7 years ago.
I have the below function, But when I run the code make error like:
Fatal error: Using $this when not in object context in E:....
How to fix it. I replace $this-> with self:: but it failed too.
Please help in this regards,
<?php
function cehck_files()
{
$file1 = 'C:\xampp\htdocs\test\test1.php';
$file2 = 'C:\xampp\htdocs\test\test2.php';
$test = $this->compareFiles($file1,$file2,true);
$test_display = $this->toTable($test);
echo "<pre>";
print_r($test_display);
print_r($test);
echo "</pre>";
}
function compareFiles($file1, $file2, $compareCharacters = false) {
return $this->compare(file_get_contents($file1),file_get_contents($file2),$compareCharacters);
}
function compare($string1, $string2, $compareCharacters = false) {
$start = 0;
if ($compareCharacters){
$sequence1 = $string1;
$sequence2 = $string2;
$end1 = strlen($string1) - 1;
$end2 = strlen($string2) - 1;
} else {
$sequence1 = preg_split('/\R/', $string1);
$sequence2 = preg_split('/\R/', $string2);
$end1 = count($sequence1) - 1;
$end2 = count($sequence2) - 1;
}
// skip any common prefix
while ($start <= $end1 && $start <= $end2 && $sequence1[$start] == $sequence2[$start]) {
$start ++;
}
// skip any common suffix
while ($end1 >= $start && $end2 >= $start && $sequence1[$end1] == $sequence2[$end2]) {
$end1 --;
$end2 --;
}
// compute the table of longest common subsequence lengths
$table = self::computeTable($sequence1, $sequence2, $start, $end1, $end2);
// generate the partial diff
$partialDiff =
self::generatePartialDiff($table, $sequence1, $sequence2, $start);
// generate the full diff
$diff = array();
for ($index = 0; $index < $start; $index ++){
$diff[] = array($sequence1[$index], UNMODIFIED);
}
while (count($partialDiff) > 0) $diff[] = array_pop($partialDiff);
for ($index = $end1 + 1; $index < ($compareCharacters ? strlen($sequence1) : count($sequence1)); $index ++) {
$diff[] = array($sequence1[$index], UNMODIFIED);
}
// return the diff
return $diff;
}
function computeTable($sequence1, $sequence2, $start, $end1, $end2) {
$length1 = $end1 - $start + 1;
$length2 = $end2 - $start + 1;
// initialise the table
$table = array(array_fill(0, $length2 + 1, 0));
// loop over the rows
for ($index1 = 1; $index1 <= $length1; $index1 ++) {
// create the new row
$table[$index1] = array(0);
// loop over the columns
for ($index2 = 1; $index2 <= $length2; $index2 ++){
// store the longest common subsequence length
if ($sequence1[$index1 + $start - 1] == $sequence2[$index2 + $start - 1]) {
$table[$index1][$index2] = $table[$index1 - 1][$index2 - 1] + 1;
} else {
$table[$index1][$index2] =
max($table[$index1 - 1][$index2], $table[$index1][$index2 - 1]);
}
}
}
// return the table
return $table;
}
function generatePartialDiff( $table, $sequence1, $sequence2, $start ) {
$diff = array();
// initialise the indices
$index1 = count($table) - 1;
$index2 = count($table[0]) - 1;
// loop until there are no items remaining in either sequence
while ($index1 > 0 || $index2 > 0){
// check what has happened to the items at these indices
if ($index1 > 0 && $index2 > 0 && $sequence1[$index1 + $start - 1] == $sequence2[$index2 + $start - 1]) {
// update the diff and the indices
$diff[] = array($sequence1[$index1 + $start - 1], UNMODIFIED);
$index1 --;
$index2 --;
} elseif ($index2 > 0 && $table[$index1][$index2] == $table[$index1][$index2 - 1]) {
// update the diff and the indices
$diff[] = array($sequence2[$index2 + $start - 1], INSERTED);
$index2 --;
}else{
// update the diff and the indices
$diff[] = array($sequence1[$index1 + $start - 1], DELETED);
$index1 --;
}
}
// return the diff
return $diff;
}
function toTable($diff, $indentation = '', $separator = '<br>') {
$html = $indentation . "<table class=\"diff\">\n";
// loop over the lines in the diff
$index = 0;
while ($index < count($diff)){
// determine the line type
switch ($diff[$index][1]){
// display the content on the left and right
case UNMODIFIED:
$leftCell =
self::getCellContent(
$diff, $indentation, $separator, $index, UNMODIFIED);
$rightCell = $leftCell;
break;
// display the deleted on the left and inserted content on the right
case DELETED:
$leftCell =
self::getCellContent(
$diff, $indentation, $separator, $index, DELETED);
$rightCell =
self::getCellContent(
$diff, $indentation, $separator, $index, INSERTED);
break;
// display the inserted content on the right
case INSERTED:
$leftCell = '';
$rightCell =
self::getCellContent(
$diff, $indentation, $separator, $index, INSERTED);
break;
}
// extend the HTML with the new row
$html .=
$indentation
. " <tr>\n"
. $indentation
. ' <td class="diff'
. ($leftCell == $rightCell
? 'Unmodified'
: ($leftCell == '' ? 'Blank' : 'Deleted'))
. '">'
. $leftCell
. "</td>\n"
. $indentation
. ' <td class="diff'
. ($leftCell == $rightCell
? 'Unmodified'
: ($rightCell == '' ? 'Blank' : 'Inserted'))
. '">'
. $rightCell
. "</td>\n"
. $indentation
. " </tr>\n";
}
// return the HTML
return $html . $indentation . "</table>\n";
}
?>
You are using $this for a function which is not a method of any class.
Instead of
$test = $this->compareFiles($file1,$file2,true);
Use:
$test = compareFiles($file1,$file2,true);
Also, change
return $this->compare(file_get_contents($file1),file_get_contents($file2),$compareCharacters);
To
return compare(file_get_contents($file1),file_get_contents($file2),$compareCharacters);
And to the remaining changes in this way.

i want to sum all digit in a number

i want to add all digit in a number and if it is 11,22 then i want to display only 11 or 22 else i want to make it a single digit.
example 30=3+0=3
28=2+8=10=1+0=1
i just made a codebut it have an error
please help.
<?php
$day = 17;
$month = 8;
$year = 1993;
function sumday($day)
{
if ($day == 11)
{
$sday = 11;
}
elseif ($day == 22)
{
$sday = 22;
}
elseif ($day == 29)
{
$sday = 11;
}
else
{
do {
$nday = $day . "";
$sday = 0;
for ($i = 0; $i < strlen($nday); ++$i)
{
$sday += $nday[$i];
}
while ($sday <=9);
}
return $sday;
}
First of all I would suggest you to learn to separate the tasks that a function do.
You ask to sum up the digits of a number, you may first create a function called sum_digits
<?php
function sum_digits($num) {
if ($num < 10)
return $num;
return $num % 10 + sum_digits(floor($num/10));
}
and then via conditional do whatever you need to do.
please refer to unnikked's answer, that's a good answer.
And here's the full code, combined with unnikked's answer
<?php
$day = 17;
$month = 8;
$year = 1993;
function sumday($day)
{
if ($day == 11)
{
$sday = 11;
}
elseif ($day == 22)
{
$sday = 22;
}
elseif ($day == 29)
{
$sday = 11;
}
else{
$sday = $day;
do {
$sday = $sday % 10 + floor($sday/10);
} while ($sday >= 10);
}
return $sday;
}
?>
EDIT: If you want to return the sum if it's 11,22,33 in the while loop, then put the conditions in the while loop rather than using if else condition, it's much simpler tho :)
function sumday($day)
{
$sday = $day;
while ($sday >= 10 && $sday != 11 && $sday != 22 && $sday != 29){
$sday = $sday % 10 + floor($sday/10);
}
return $sday;
}
EDIT: here's the logic that can split the day and sum them
function sumday($day)
{
$sday = $day;
$arrday = str_split($sday); // split the day into array
$sumarrday = 0;
for($i = 0; $i < strlen((string)$sday); $i++){
$sumarrday = $sumarrday + $arrday[$i]; // sum the day from the array
}
$sday = $sumarrday;
// here you can modify the condition of while statement for your needs
// for example, if you want to return 29 when 29 shows up, add this to your condition, && $sday != 29
while ($sday >= 10){
$sday = $sday % 10 + floor($sday/10);
}
return $sday;
}
Try this:
else {
$nday = $day . ""; //moved out wrom loop
do {
$sday = 0;
for ($i = 0; $i < strlen($nday); ++$i)
{
$sday += $nday[$i];
}
$nday = $sday . ""; // you forget this line
while ($sday <=9);
}

automatic number increase in php based web form [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
So I have created an html form which then posts the results to a php file that overlays them on a PDF and then emails that PDF to myself and the email that was put in the form. All I want to do now is find a simple way to make it so that the PDF includes a sequential number.
For example: When the form is filled out for the first time the number 0001 is input automatically into the PDF and 0002 for the second time and so on.
Is there an easy PHP function to accomplish this?
Essentially I am creating an online invoicing form so when I do service calls I can create an invoice on the spot from a web browser which is then emailed to my office and the client.
Any help would be greatly appreciated.
For an incrementing number, you could keep a number in a database and then extract it, add 1 to it, use it, and then put it back in the DB for next time, but this seems complicated. Somebody in the comments mentioned using the timestamp, which would be done like so:
$invoicenumber = time(); //This number will always be unique
The time function works like so (copied from w3schools):
The time() function returns the current time in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
Since actual seconds can only go up (increment), this number will never be the same twice.
I hope this is helpful.
-Edit
You can also display this date/time in a readable format like so:
$time = time();
echo date("Y-m-d H:i:s",$time);
-Edit 2
If you want an incrementing number, you basically need a very simple database to save it, which might be as simple as a table called invoices, with a column called invoicenumber, which stores your invoice number in it. You could / probably should use this to store other invoice information in it too, so you'd have each invoice number saved (which means we want to only get the highest one)
Then your code would look like this, for each time you want to use it:
Firstly you'd have a database information file (settings.php or something similar) with your database definitions in it, which might look like this:
define('DB_HOST', 'localhost');
define('DB_USER', 'db_username');
define('DB_PASS', 'db_password');
define('DB_NAME', 'database_name');
Your code would look like this:
//Establish a mysql connection
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
//Set up a query to get the highest number
$query = "SELECT invoicenumber FROM invoices ORDER BY invoicenumber DESC LIMIT 1";
//Get the result
$result = $mysqli->query($query);
$row = $result->fetch_assoc();
//If we have a record
if($row){
//New invoice number
$invoicenumber = $row['invoicenumber']++;
//Else (database is empty, so start at the beginning)
}else{
$invoicenumber = 1;
}
//Now we have our invoice number, so do whatever you want with it
/**
* Code here to use the number
* */
//Now we wanna add the new invoice to the database, so
/**
* Add any other info to this statement if you want.
* If any of it is user submitted data, be sure to use prepared statements
* (just look at php.net's documentation on prepared statements)
* w3schools also has some nice tutorials on how to safely insert stuff
* in to a database, so check it all out :)
* */
$query = "INSERT INTO invoices(invoicenumber) VALUES($invoicenumber)";
//Execute the query
if($mysqli->query($query)){
//Show success
echo "Invoice $invoicenumber has been added to the database.";
}else{
//Show error
echo "Unfortunately we could not add invoice $invoicenumber to the database.";
}
//Now we can clear up our resources
$stmt->free_result(); $stmt->close(); $mysqli->close();
Please note: this is a very basic example. Yours will have additions and enhanced security if you are using user submitted data, so please do your homework and make sure that you fully understand each line of this code before you proceed to use it.
I do exactly the same with patient accession numbers on patient reports.
include('/home/user/php/class.pdf2text.php');
$p2t = new PDF2Text();
$p2t->setFilename($pdf);
$p2t->decodePDF();
$data = $p2t->output();
$len = strlen($data);
$pos = strpos($data,$accession);
if (pos){
$in .= "$accession,";
$checked++;
}
else{
$missingPDF += 1;echo "\n<p> <span class='bold red'>INCORRECT ACCESSION NUMBER c=$row[0] p=$row[1]</span>\n";
}
if ($checked > 0){
$in = substr($in,0,-1) . ')';
$sql = "UPDATE `Patient` SET `PDF`=1 WHERE $in";
}
pdf2text.php
class PDF2Text {
// Some settings
var $multibyte = 4; // Use setUnicode(TRUE|FALSE)
var $convertquotes = ENT_QUOTES; // ENT_COMPAT (double-quotes), ENT_QUOTES (Both), ENT_NOQUOTES (None)
var $showprogress = true; // TRUE if you have problems with time-out
// Variables
var $filename = '';
var $decodedtext = '';
function setFilename($filename) {
// Reset
$this->decodedtext = '';
$this->filename = $filename;
}
function output($echo = false) {
if($echo) echo $this->decodedtext;
else return $this->decodedtext;
}
function setUnicode($input) {
// 4 for unicode. But 2 should work in most cases just fine
if($input == true) $this->multibyte = 4;
else $this->multibyte = 2;
}
function decodePDF() {
// Read the data from pdf file
$infile = #file_get_contents($this->filename, FILE_BINARY);
if (empty($infile))
return "";
// Get all text data.
$transformations = array();
$texts = array();
// Get the list of all objects.
preg_match_all("#obj[\n|\r](.*)endobj[\n|\r]#ismU", $infile . "endobj\r", $objects);
$objects = #$objects[1];
// Select objects with streams.
for ($i = 0; $i < count($objects); $i++) {
$currentObject = $objects[$i];
// Prevent time-out
#set_time_limit ();
if($this->showprogress) {
// echo ". ";
flush(); ob_flush();
}
// Check if an object includes data stream.
if (preg_match("#stream[\n|\r](.*)endstream[\n|\r]#ismU", $currentObject . "endstream\r", $stream )) {
$stream = ltrim($stream[1]);
// Check object parameters and look for text data.
$options = $this->getObjectOptions($currentObject);
if (!(empty($options["Length1"]) && empty($options["Type"]) && empty($options["Subtype"])) )
// if ( $options["Image"] && $options["Subtype"] )
// if (!(empty($options["Length1"]) && empty($options["Subtype"])) )
continue;
// Hack, length doesnt always seem to be correct
unset($options["Length"]);
// So, we have text data. Decode it.
$data = $this->getDecodedStream($stream, $options);
if (strlen($data)) {
if (preg_match_all("#BT[\n|\r](.*)ET[\n|\r]#ismU", $data . "ET\r", $textContainers)) {
$textContainers = #$textContainers[1];
$this->getDirtyTexts($texts, $textContainers);
} else
$this->getCharTransformations($transformations, $data);
}
}
}
// Analyze text blocks taking into account character transformations and return results.
$this->decodedtext = $this->getTextUsingTransformations($texts, $transformations);
}
function decodeAsciiHex($input) {
$output = "";
$isOdd = true;
$isComment = false;
for($i = 0, $codeHigh = -1; $i < strlen($input) && $input[$i] != '>'; $i++) {
$c = $input[$i];
if($isComment) {
if ($c == '\r' || $c == '\n')
$isComment = false;
continue;
}
switch($c) {
case '\0': case '\t': case '\r': case '\f': case '\n': case ' ': break;
case '%':
$isComment = true;
break;
default:
$code = hexdec($c);
if($code === 0 && $c != '0')
return "";
if($isOdd)
$codeHigh = $code;
else
$output .= chr($codeHigh * 16 + $code);
$isOdd = !$isOdd;
break;
}
}
if($input[$i] != '>')
return "";
if($isOdd)
$output .= chr($codeHigh * 16);
return $output;
}
function decodeAscii85($input) {
$output = "";
$isComment = false;
$ords = array();
for($i = 0, $state = 0; $i < strlen($input) && $input[$i] != '~'; $i++) {
$c = $input[$i];
if($isComment) {
if ($c == '\r' || $c == '\n')
$isComment = false;
continue;
}
if ($c == '\0' || $c == '\t' || $c == '\r' || $c == '\f' || $c == '\n' || $c == ' ')
continue;
if ($c == '%') {
$isComment = true;
continue;
}
if ($c == 'z' && $state === 0) {
$output .= str_repeat(chr(0), 4);
continue;
}
if ($c < '!' || $c > 'u')
return "";
$code = ord($input[$i]) & 0xff;
$ords[$state++] = $code - ord('!');
if ($state == 5) {
$state = 0;
for ($sum = 0, $j = 0; $j < 5; $j++)
$sum = $sum * 85 + $ords[$j];
for ($j = 3; $j >= 0; $j--)
$output .= chr($sum >> ($j * 8));
}
}
if ($state === 1)
return "";
elseif ($state > 1) {
for ($i = 0, $sum = 0; $i < $state; $i++)
$sum += ($ords[$i] + ($i == $state - 1)) * pow(85, 4 - $i);
for ($i = 0; $i < $state - 1; $i++) {
try {
if(false == ($o = chr($sum >> ((3 - $i) * 8)))) {
throw new Exception('Error');
}
$output .= $o;
} catch (Exception $e) { /*Dont do anything*/ }
}
}
return $output;
}
function decodeFlate($data) {
return #gzuncompress($data);
}
function getObjectOptions($object) {
$options = array();
if (preg_match("#<<(.*)>>#ismU", $object, $options)) {
$options = explode("/", $options[1]);
#array_shift($options);
$o = array();
for ($j = 0; $j < #count($options); $j++) {
$options[$j] = preg_replace("#\s+#", " ", trim($options[$j]));
if (strpos($options[$j], " ") !== false) {
$parts = explode(" ", $options[$j]);
$o[$parts[0]] = $parts[1];
} else
$o[$options[$j]] = true;
}
$options = $o;
unset($o);
}
return $options;
}
function getDecodedStream($stream, $options) {
$data = "";
if (empty($options["Filter"]))
$data = $stream;
else {
$length = !empty($options["Length"]) ? $options["Length"] : strlen($stream);
$_stream = substr($stream, 0, $length);
foreach ($options as $key => $value) {
if ($key == "ASCIIHexDecode")
$_stream = $this->decodeAsciiHex($_stream);
elseif ($key == "ASCII85Decode")
$_stream = $this->decodeAscii85($_stream);
elseif ($key == "FlateDecode")
$_stream = $this->decodeFlate($_stream);
elseif ($key == "Crypt") { // TO DO
}
}
$data = $_stream;
}
return $data;
}
function getDirtyTexts(&$texts, $textContainers) {
for ($j = 0; $j < count($textContainers); $j++) {
if (preg_match_all("#\[(.*)\]\s*TJ[\n|\r]#ismU", $textContainers[$j], $parts))
$texts = array_merge($texts, array(#implode('', $parts[1])));
elseif (preg_match_all("#T[d|w|m|f]\s*(\(.*\))\s*Tj[\n|\r]#ismU", $textContainers[$j], $parts))
$texts = array_merge($texts, array(#implode('', $parts[1])));
elseif (preg_match_all("#T[d|w|m|f]\s*(\[.*\])\s*Tj[\n|\r]#ismU", $textContainers[$j], $parts))
$texts = array_merge($texts, array(#implode('', $parts[1])));
}
}
function getCharTransformations(&$transformations, $stream) {
preg_match_all("#([0-9]+)\s+beginbfchar(.*)endbfchar#ismU", $stream, $chars, PREG_SET_ORDER);
preg_match_all("#([0-9]+)\s+beginbfrange(.*)endbfrange#ismU", $stream, $ranges, PREG_SET_ORDER);
for ($j = 0; $j < count($chars); $j++) {
$count = $chars[$j][1];
$current = explode("\n", trim($chars[$j][2]));
for ($k = 0; $k < $count && $k < count($current); $k++) {
if (preg_match("#<([0-9a-f]{2,4})>\s+<([0-9a-f]{4,512})>#is", trim($current[$k]), $map))
$transformations[str_pad($map[1], 4, "0")] = $map[2];
}
}
for ($j = 0; $j < count($ranges); $j++) {
$count = $ranges[$j][1];
$current = explode("\n", trim($ranges[$j][2]));
for ($k = 0; $k < $count && $k < count($current); $k++) {
if (preg_match("#<([0-9a-f]{4})>\s+<([0-9a-f]{4})>\s+<([0-9a-f]{4})>#is", trim($current[$k]), $map)) {
$from = hexdec($map[1]);
$to = hexdec($map[2]);
$_from = hexdec($map[3]);
for ($m = $from, $n = 0; $m <= $to; $m++, $n++)
$transformations[sprintf("%04X", $m)] = sprintf("%04X", $_from + $n);
} elseif (preg_match("#<([0-9a-f]{4})>\s+<([0-9a-f]{4})>\s+\[(.*)\]#ismU", trim($current[$k]), $map)) {
$from = hexdec($map[1]);
$to = hexdec($map[2]);
$parts = preg_split("#\s+#", trim($map[3]));
for ($m = $from, $n = 0; $m <= $to && $n < count($parts); $m++, $n++)
$transformations[sprintf("%04X", $m)] = sprintf("%04X", hexdec($parts[$n]));
}
}
}
}
function getTextUsingTransformations($texts, $transformations) {
$document = "";
for ($i = 0; $i < count($texts); $i++) {
$isHex = false;
$isPlain = false;
$hex = "";
$plain = "";
for ($j = 0; $j < strlen($texts[$i]); $j++) {
$c = $texts[$i][$j];
switch($c) {
case "<":
$hex = "";
$isHex = true;
$isPlain = false;
break;
case ">":
$hexs = str_split($hex, $this->multibyte); // 2 or 4 (UTF8 or ISO)
for ($k = 0; $k < count($hexs); $k++) {
$chex = str_pad($hexs[$k], 4, "0"); // Add tailing zero
if (isset($transformations[$chex]))
$chex = $transformations[$chex];
$document .= html_entity_decode("&#x".$chex.";");
}
$isHex = false;
break;
case "(":
$plain = "";
$isPlain = true;
$isHex = false;
break;
case ")":
$document .= $plain;
$isPlain = false;
break;
case "\\":
$c2 = $texts[$i][$j + 1];
if (in_array($c2, array("\\", "(", ")"))) $plain .= $c2;
elseif ($c2 == "n") $plain .= '\n';
elseif ($c2 == "r") $plain .= '\r';
elseif ($c2 == "t") $plain .= '\t';
elseif ($c2 == "b") $plain .= '\b';
elseif ($c2 == "f") $plain .= '\f';
elseif ($c2 >= '0' && $c2 <= '9') {
$oct = preg_replace("#[^0-9]#", "", substr($texts[$i], $j + 1, 3));
$j += strlen($oct) - 1;
$plain .= html_entity_decode("&#".octdec($oct).";", $this->convertquotes);
}
$j++;
break;
default:
if ($isHex)
$hex .= $c;
elseif ($isPlain)
$plain .= $c;
break;
}
}
$document .= "\n";
}
return $document;
}
}

Include file and Functions PHP

i have 2 php files file1.php with some global varibles
and file2.php with several functions changing the files1 variables values after some x condition.
The only problem i have the file1.php which includes file2.php doesn't echo / return the values. The code is below:
file1.php
if ($result) {
if ($result['image'] && file_exists(RC_UPLOADS_DIR . "vehicle_" . $result['image'])) {
$image = RC_UPLOADS_URL . 'vehicle_' . $result['image'];
$image_thumb = RC_UPLOADS_URL . 'cache/' . rc_image_resize(RC_UPLOADS_DIR . "vehicle_" . $result['image'], 160, 120);
} else {
$image = '';
$image_thumb = '';
}
$description = preg_replace(array("/\s\s/", "/\r\r/", "/\n\n/"), '<br />', trim($result['description']));
$vehicle_meta = rc_getVehicleMeta($vehicle_id);
global $GeneralPrice, $discount_price, $rent, $rent1, $rent2, $rent3,$rent4, $rent5, $rent6, $rent7, $rent8, $rent9, $rent10, $rent11, $rent12, $rent13, $rent14, $rent15, $rent16, $rent17, $rent18, $rent19, $rent20, $rent21, $rent22, $rent23, $rent24, $rent25, $rent26, $rent27, $rent28, $rent29, $rent30, $rent31, $rent32, $rent33, $rent34, $rent35, $rent36;
$rent = $result['rent'];
$rent1 = $vehicle_meta['rent1'];
$rent2 = $vehicle_meta['rent2'];
$rent3 = $vehicle_meta['rent3'];
$rent4 = $vehicle_meta['rent4'];
$rent5 = $vehicle_meta['rent5'];
$rent6 = $vehicle_meta['rent6'];
$rent7 = $vehicle_meta['rent7'];
$rent8 = $vehicle_meta['rent8'];
$rent9 = $vehicle_meta['rent9'];
$rent10 = $vehicle_meta['rent10'];
$rent11 = $vehicle_meta['rent11'];
$rent12 = $vehicle_meta['rent12'];
$rent13 = $vehicle_meta['rent13'];
$rent14 = $vehicle_meta['rent14'];
$rent15 = $vehicle_meta['rent15'];
$rent16 = $vehicle_meta['rent16'];
$rent17 = $vehicle_meta['rent17'];
$rent18 = $vehicle_meta['rent18'];
$rent19 = $vehicle_meta['rent19'];
$rent20 = $vehicle_meta['rent20'];
$rent21 = $vehicle_meta['rent21'];
$rent22 = $vehicle_meta['rent22'];
$rent23 = $vehicle_meta['rent23'];
$rent24 = $vehicle_meta['rent24'];
$rent25 = $vehicle_meta['rent25'];
$rent26 = $vehicle_meta['rent26'];
$rent27 = $vehicle_meta['rent27'];
$rent28 = $vehicle_meta['rent28'];
$rent29 = $vehicle_meta['rent29'];
$rent30 = $vehicle_meta['rent30'];
$rent31 = $vehicle_meta['rent31'];
$rent32 = $vehicle_meta['rent32'];
$rent33 = $vehicle_meta['rent33'];
$rent34 = $vehicle_meta['rent34'];
$rent35 = $vehicle_meta['rent35'];
$rent36 = $vehicle_meta['rent36'];
include_once('files2.php');
$vehicle = array(
'vehicle_id' => $result['vehicle_id'],
'title' => $result['manufacturer']." ".$result['series'],
'manufacturer' => $result['manufacturer'],
'series' => $result['series'],
'year' => $result['year'],
'class' => $result['class'],
'image' => $image,
'image_thumb' => $image_thumb,
'description' => $description,
'seats' => $vehicle_meta['seats'],
'doors' => $vehicle_meta['doors'],
'baggages' => $vehicle_meta['baggages'],
'conditioning' => $vehicle_meta['conditioning'],
'transmission' => $vehicle_meta['transmission'],
'total_price' => $rc_currency->format((($rental_days*$GeneralPrice )-($rental_days*$GeneralPrice)* ($discount_price)/100)+ $total_extras),
'total_price_return_fee' => $rc_currency->format((($rental_days*$GeneralPrice)-($rental_days*$GeneralPrice)* ($discount_price)/100)+ $xfee + $total_extras),
'total_price_return_fee' => $rc_currency->format((($rental_days*$GeneralPrice)-($rental_days*$GeneralPrice)* ($discount_price)/100)+ $xfee2 + $total_extras),
'daily_price' => $rc_currency->format((($GeneralPrice)-($GeneralPrice)* ($discount_price)/100)+ $excess_price),
'daily_price_return_fee' => $rc_currency->format((($GeneralPrice)-($GeneralPrice)* ($discount_price)/100)+ ( $xfee / $rental_days)),
'daily_price_return_fee2' => $rc_currency->format((($GeneralPrice)-($GeneralPrice)*($discount_price)/100)+ ( $xfee2 / $rental_days))
);
}
return $vehicle;
}
File2.php
<?php
//Out of Season function
function outofseason(){
global $rental_days, $GeneralPrice, $discount_price, $days1,$discount1, $days2, $discount2, $days3, $discount3, $rent;
//Discount with Duration
$days1 = get_field('days');
$discount1 = get_field('discount_days1');
$days2 = get_field('days2');
$discount2 = get_field('discount_days2');
$days3 = get_field('days3');
$discount3 = get_field('discount_days3');
$GeneralPrice = $rent;
if($rental_days > $days1 && $rental_days < $days2){
return $discount_price = $discount1;
}elseif($rental_days > $days2 && $rental_days < $days3){
return $discount_price = $discount1 + $discount2;
}elseif($rental_days > $days3 && $discount3 !=0){
return $discount_price = $discount1 + $discount2 + $discount3;
}else{
return $discount_price = 0;
}
}
//Seasons
function Seasonlow() {
global $rental_days, $GeneralPrice, $discount_price, $season_start_date_low, $season_end_date_low, $rent1, $rent2, $rent3, $rent4, $rent5, $rent6, $rent7, $rent8, $rent9;
//Date calculator
$datetime1 = '2014-02-05';
$datetime2 = '2014-04-15';
$duration = 86400 ;
$days_dur = ceil(strtotime($datetime2)-strtotime($datetime1))/$duration;
//$season_start_date_low = '05/02/2014';
//$season_end_date_low = '15/02/2014';
$pickupdate = $_GET['pickup_date'];
$returndate = $_GET['return_date'];
//if($pickupdate >= $season_start_date_low && $returndate <= $season_end_date_low){
if($rental_days == 1){
return $GeneralPrice = $rent1;
$discount_price = 0;
}elseif($rental_days == 2){
return $GeneralPrice = $rent2;
$discount_price = 0;
}elseif($rental_days == 3){
return $GeneralPrice = $rent3;
$discount_price = 0;
}elseif($rental_days == 4){
return $GeneralPrice = $rent4;
$discount_price = 0;
}elseif($rental_days == 5){
return $GeneralPrice = $rent5;
$discount_price = 0;
}elseif($rental_days == 6){
return $GeneralPrice = $rent6;
$discount_price = 0;
}elseif($rental_days >= 7 && $rental_days <= 13){
return $GeneralPrice = $rent7;
$discount_price = 0;
}elseif($rental_days >= 14 && $rental_days <= 20){
return $GeneralPrice = $rent8;
$discount_price = 0;
}elseif($rental_days >= 21){
return $GeneralPrice = $rent9;
$discount_price = 0;
}
//}else {
//outofseason();
//}
}
//Season Mid
function Seasonmid() {
global $rental_days, $GeneralPrice, $discount_price, $season_start_date_mid, $season_end_date_mid, $rent10, $rent11, $rent12, $rent13, $rent14, $rent15, $rent16, $rent17, $rent18;
//Date calculator
$datetime1 = '2014-02-05';
$datetime2 = '2014-04-15';
$duration = 86400 ;
$days_dur = ceil(strtotime($datetime2)-strtotime($datetime1))/$duration;
//$season_start_date_mid = '05/03/2014';
//$season_end_date_mid = '15/03/2014';
$pickupdate = $_GET['pickup_date'];
$returndate = $_GET['return_date'];
//if($pickupdate >= $season_start_date_mid && $returndate <= $season_end_date_mid){
if($rental_days == 1){
return $GeneralPrice = $rent10;
$discount_price = 0;
}elseif($rental_days == 2){
return $GeneralPrice = $rent11;
$discount_price = 0;
}elseif($rental_days == 3){
return $GeneralPrice = $rent12;
$discount_price = 0;
}elseif($rental_days == 4){
return $GeneralPrice = $rent13;
$discount_price = 0;
}elseif($rental_days == 5){
return $GeneralPrice = $rent14;
$discount_price = 0;
}elseif($rental_days == 6){
return $GeneralPrice = $rent15;
$discount_price = 0;
}elseif($rental_days >= 7 && $rental_days <= 13){
return $GeneralPrice = $rent16;
$discount_price = 0;
}elseif($rental_days >= 14 && $rental_days <= 20){
return $GeneralPrice = $rent17;
$discount_price = 0;
}elseif($rental_days >= 21){
return $GeneralPrice = $rent18;
$discount_price = 0;
}
//}else {
// outofseason();
//}
}
//Season Mid_B
function Seasonmid_B() {
global $rental_days, $GeneralPrice, $discount_price, $season_start_date_mid_B, $season_end_date_mid_B, $rent19, $rent20, $rent21, $rent22, $rent23, $rent24, $rent25, $rent26, $rent27;
//Date calculator
$datetime1 = '2014-02-05';
$datetime2 = '2014-04-15';
$duration = 86400 ;
$days_dur = ceil(strtotime($datetime2)-strtotime($datetime1))/$duration;
//$season_start_date_mid = '05/03/2014';
//$season_end_date_mid = '15/03/2014';
$pickupdate = $_GET['pickup_date'];
$returndate = $_GET['return_date'];
//if($pickupdate >= $season_start_date_mid && $returndate <= $season_end_date_mid){
if($rental_days == 1){
return $GeneralPrice = $rent19;
$discount_price = 0;
}elseif($rental_days == 2){
return $GeneralPrice = $rent20;
$discount_price = 0;
}elseif($rental_days == 3){
return $GeneralPrice = $rent21;
$discount_price = 0;
}elseif($rental_days == 4){
return $GeneralPrice = $rent22;
$discount_price = 0;
}elseif($rental_days == 5){
return $GeneralPrice = $rent23;
$discount_price = 0;
}elseif($rental_days == 6){
return $GeneralPrice = $rent24;
$discount_price = 0;
}elseif($rental_days >= 7 && $rental_days <= 13){
return $GeneralPrice = $rent25;
$discount_price = 0;
}elseif($rental_days >= 14 && $rental_days <= 20){
return $GeneralPrice = $rent26;
$discount_price = 0;
}elseif($rental_days >= 21){
return $GeneralPrice = $rent27;
$discount_price = 0;
}
//}else {
// outofseason();
//}
}
//Season Mid_B
function SeasonHigh() {
global $rental_days, $GeneralPrice, $discount_price, $season_start_date_mid_high, $season_end_date_high, $rent28, $rent29, $rent30, $rent31, $rent32, $rent33, $rent34, $rent35, $rent36;
//Date calculator
$datetime1 = '2014-02-05';
$datetime2 = '2014-04-15';
$duration = 86400 ;
$days_dur = ceil(strtotime($datetime2)-strtotime($datetime1))/$duration;
//$season_start_date_mid = '05/03/2014';
//$season_end_date_mid = '15/03/2014';
$pickupdate = $_GET['pickup_date'];
$returndate = $_GET['return_date'];
//if($pickupdate >= $season_start_date_mid && $returndate <= $season_end_date_mid){
if($rental_days == 1){
return $GeneralPrice = $rent28;
$discount_price = 0;
}elseif($rental_days == 2){
return $GeneralPrice = $rent29;
$discount_price = 0;
}elseif($rental_days == 3){
return $GeneralPrice = $rent30;
$discount_price = 0;
}elseif($rental_days == 4){
return $GeneralPrice = $rent31;
$discount_price = 0;
}elseif($rental_days == 5){
return $GeneralPrice = $rent32;
$discount_price = 0;
}elseif($rental_days == 6){
return $GeneralPrice = $rent33;
$discount_price = 0;
}elseif($rental_days >= 7 && $rental_days <= 13){
return $GeneralPrice = $rent34;
$discount_price = 0;
}elseif($rental_days >= 14 && $rental_days <= 20){
return $GeneralPrice = $rent35;
$discount_price = 0;
}elseif($rental_days >= 21){
return $GeneralPrice = $rent36;
$discount_price = 0;
}
//}else {
// outofseason();
//}
}
//low
$season_start_date_low = (get_option('rc_settings_season_start_date_low'));
$season_end_date_low = (get_option('rc_settings_season_end_date_low'));
$season_start_date_low_convert = str_replace('/', '-', $season_start_date_low);
$season_low_start = date('Y-m-d', strtotime($season_start_date_low_convert));
$season_end_date_low_convert = str_replace('/', '-', $season_end_date_low);
$season_low_end = date('Y-m-d', strtotime($season_end_date_low_convert));
//mid
$season_start_date_mid = get_option('rc_settings_season_start_date_mid');
$season_end_date_mid = get_option('rc_settings_season_end_date_mid');
$season_start_date_mid_B = get_option('rc_settings_season_start_date_mid_B');
$season_end_date_mid_B = get_option('rc_settings_season_end_date_mid_B');
$season_start_date_mid_convert = str_replace('/', '-', $season_start_date_mid);
$season_mid_start = date('Y-m-d', strtotime($season_start_date_mid_convert));
$season_end_date_mid_convert = str_replace('/', '-', $season_end_date_mid);
$season_mid_end = date('Y-m-d', strtotime($season_end_date_mid_convert));
$season_start_date_mid_B_convert = str_replace('/', '-', $season_start_date_mid_B);
$season_mid_B_start = date('Y-m-d', strtotime($season_start_date_mid_B_convert));
$season_end_date_mid_B_convert = str_replace('/', '-', $season_end_date_mid_B);
$season_mid_B_end = date('Y-m-d', strtotime($season_end_date_mid_B_convert));
//High
$season_start_date_high = get_option('rc_settings_season_start_date_high');
$season_end_date_high = get_option('rc_settings_season_end_date_high');
$season_start_date_high_convert = str_replace('/', '-', $season_start_date_high);
$season_high_start = date('Y-m-d', strtotime($season_start_date_high_convert));
$season_end_date_high_convert = str_replace('/', '-', $season_end_date_high);
$season_high_end = date('Y-m-d', strtotime($season_end_date_high_convert));
//Date calculator
//$datetime1 = '01/01/2014';
//$datetime2 = '04/02/2014';
//$duration = 86400 ;
//$days_dur = ceil(strtotime($season_start_date_low)- strtotime($season_end_date_low))/$duration;
//Dates Conversion
$pickupdate_final = $_GET['pickup_date'];
$pickupdate_final_convert = str_replace('/', '-', $pickupdate_final);
$pickup_dates = date('Y-m-d', strtotime($pickupdate_final_convert));
$returndate_final = $_GET['return_date'];
$returndate_final_convert = str_replace('/', '-', $returndate_final);
$return_dates = date('Y-m-d', strtotime($returndate_final_convert));
//Conditions
if($pickup_dates >= $season_low_start && $return_dates <= $season_low_end){
Seasonlow();
echo "low <br />";
}elseif($pickup_dates >= $season_mid_start && $return_dates <= $season_mid_end){
Seasonmid();
echo "mid <br />";
}elseif($pickup_dates >= $season_mid_B_start && $return_dates <= $season_mid_B_end){
Seasonmid_B();
echo "mid_B <br />";
}elseif($pickup_dates >= $season_high_start && $return_dates <= $season_high_end){
SeasonHigh();
echo "High <br />";
}else{
outofseason();
echo "out <br />";
}
?>
include_once('files2.php');
Should be:
include_once('file2.php');

Categories