How to include a custom function file
-
I would like to use the following code on one of my pages. I hard-coded it but the file is not displaying. How do I achieve this?
// Set up the airport variables $toairport = $result['destination_addresses'][0]; $fromairport= $result['origin_addresses'][0]; /** * Check if the location is an airport. * * @param string $location * @return bool */ function isAirport($location) { $airportList = ['Heathrow', 'Gatwick', 'London Luton', 'London City Airport']; foreach ($airportList as $airport) { if (strpos($location, $airport) !== false) { return true; } } return false; } if (isAirport($toairport) || isAirport($fromairport)) { ?> <div class="airport-transfer"> <p>We see that your journey involves a London airport transfer.</p> <p>On the meter, the cost can range from <b> <?php if ($Distance <= intval(1454)) { echo $DayMinDistanceCost . " </b>to<b> " .$FestiveMinDistanceCost; } else { echo $DayCost . " </b>to<b> " .$FestiveCost; } ?> </b>or higher, depending on traffic.</p> <p>We may be able to offer you a competitive flat rate. Please contact us on <b>01252-83-40-50</b> and ask for a London Airport Transfer rate.</p> </div> <div class="another-quote">Get another <a href="<?php echo $_SERVER['PHP_SELF'];?>">quote</a></div> <?php }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to include a custom function file’ is closed to new replies.