当前位置: 首页>>代码示例>>PHP>>正文


PHP Car::maxPassengers方法代码示例

本文整理汇总了PHP中Car::maxPassengers方法的典型用法代码示例。如果您正苦于以下问题:PHP Car::maxPassengers方法的具体用法?PHP Car::maxPassengers怎么用?PHP Car::maxPassengers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Car的用法示例。


在下文中一共展示了Car::maxPassengers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Bike

<?php

include "Models/Bike.php";
include "Models/Car.php";
include "Models/Plane.php";
$minutos = 10;
$vehicle = new Bike();
echo $vehicle->getName() . ': </br>';
echo 'velocidad: ' . $vehicle->speed() . '</br>';
echo 'maximo de pasajeros: ' . $vehicle->maxPassengers() . '</br>';
echo 'distancia: ' . $vehicle->travelDistance($minutos) . '</br> </br>';
$vehicle2 = new Car();
echo $vehicle2->getName() . ': </br>';
echo 'velocidad: ' . $vehicle2->speed() . '</br>';
echo 'maximo de pasajeros: ' . $vehicle2->maxPassengers() . '</br>';
echo 'distancia: ' . $vehicle2->travelDistance($minutos) . '</br> </br>';
$vehicle3 = new Plane();
echo $vehicle3->getName() . ': </br>';
echo 'velocidad: ' . $vehicle3->speed() . '</br>';
echo 'maximo de pasajeros: ' . $vehicle3->maxPassengers() . '</br>';
echo 'distancia: ' . $vehicle3->travelDistance($minutos) . '</br> </br>';
开发者ID:killyEma,项目名称:php-bootcamp,代码行数:21,代码来源:index.php

示例2: switch

 $var = $_POST['var'];
 //$pas is now number of passengers load.
 switch ($var) {
     case '1':
         $x = new Plane();
         $max = $x->maxPassengers();
         if ($new_pas <= $max) {
             echo "You can travel now";
         } else {
             $name = $x->getName();
             echo "You can not travel on a " . $name . " whit " . $new_pas . " passengers. The number of allowed passengers for the selected transport is " . $max;
         }
         break;
     case '2':
         $x = new Car();
         $max = $x->maxPassengers();
         if ($new_pas <= $max) {
             echo "You can travel now";
         } else {
             $name = $x->getName();
             echo "You can not travel on a " . $name . "whit" . $new_pas . "passengers. The number of alllowed passengers for the selected transport is" . $max;
         }
         break;
     case '3':
         $x = new Bike();
         $max = $x->maxPassengers();
         if ($new_pas <= $max) {
             echo "You can travel now";
         } else {
             $name = $x->getName();
             echo "You can not travel on a " . $name . "whit" . $new_pas . "passengers. The number of alllowed passengers for the selected transport is" . $max;
开发者ID:alurbe,项目名称:bootcamp-lp,代码行数:31,代码来源:proces.php


注:本文中的Car::maxPassengers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。