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


PHP Student::setGPA方法代码示例

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


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

示例1: printName

    }
    public function printName()
    {
        echo "name: " . $this->name . PHP_EOL;
    }
    public function setGPA($gpa)
    {
        $this->gpa = $gpa;
    }
    public function printMajor()
    {
        echo "Major: " . $this->major . PHP_EOL;
    }
}
$myStudent = new Student("Steve");
$myStudent->setGPA(2.3);
$myStudent->printName();
$myStudent->major = "Information Tech";
$var = "some value";
$number = 41234213424.0;
$realnumber = 12341234.1241241;
//this is also a comment, datebayo!
$arr = array();
$arr[] = 5;
$arr[] = "words";
$arr[] = 5345.5345;
$arr[] = array("food", "water", "shelter");
print_r($arr);
/*

this 
开发者ID:jk293,项目名称:202Project,代码行数:31,代码来源:testphp.php

示例2: PrintStudent

    }
    public function PrintStudent()
    {
        echo "Student: " . PHP_EOL;
        echo "   name: " . PHP_EOL;
        echo "   address: " . PHP_EOL;
        echo "   gpa: " . PHP_EOL;
        echo "   year: " . PHP_EOL;
    }
    public function setGpa($gpa)
    {
        $this->gpa = $gpa;
    }
}
$myStudent = new Student("Steve");
$myStudent->setGPA("2.3");
$myStudent->major = "Information Technology";
$myStudent->printName();
/*
this
whale
block
of comments
*/
$var = "some value";
$var = $var . " some other value";
$number = 412342134;
//thi is is a comment
$realNumber = 12341234.1241241;
//this is also a comment, datebayo
$arr = array();
开发者ID:sma69,项目名称:IT202Project,代码行数:31,代码来源:testphp.php

示例3: __construct

echo "begin script " . $argv[0] . PHP_EOL;
class Student
{
    private $name;
    private $address;
    private $gpa;
    private $year;
    public function __construct($name)
    {
        $this->name = $name;
        # "this" changes private or public variables with whatever variable you give it
    }
    public function printName()
    {
        echo "name: " . $this->name . PHP_EOL;
    }
    public function setGPA($gpa)
    {
        $this->gpa = $gpa;
        echo "gpa: " . $gpa . PHP_EOL;
    }
}
$myStudent = new Student("Steve");
$myStudent->printName();
$myStudent->setGPA(4.0);
$var = "some value";
$number = 248573289;
$realNumber = 1234.453;
$arr = array();
//print_r($arr);
echo "end script " . $argv[0] . PHP_EOL;
开发者ID:jeg39,项目名称:ITProject,代码行数:31,代码来源:testphp.php

示例4: printName

    }
    public function printName()
    {
        echo "name: " . $this->name . PHP_EOL;
    }
    public function setGPA($gpa)
    {
        $this->gpa = $gpa;
    }
    public function printGPA()
    {
        echo "GPA: " . $this->gpa . PHP_EOL;
    }
}
$myStudent = new Student("Joshua");
$myStudent->setGPA(3.43);
$myStudent->printName();
$myStudent->printGPA();
$myStudent->major = "Computing and Business";
$var = "some value";
$number = 2223243;
$realNumber = 1233223.233323;
$arr = array();
$arr[] = 5;
$arr[] = "words";
$arr[] = 3453434.3443;
$arr[] = array("food", "water", "shelter", "heart");
//print_r($arr);
//gives information about type of variable
//var_dump($arr);
echo "end script " . $argv[0] . PHP_EOL;
开发者ID:jbo5,项目名称:202Project,代码行数:31,代码来源:testphp.php


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