Skip to content

Instantly share code, notes, and snippets.

@shouhei
Created June 17, 2014 13:47
Show Gist options
  • Select an option

  • Save shouhei/3caa199c01b652356753 to your computer and use it in GitHub Desktop.

Select an option

Save shouhei/3caa199c01b652356753 to your computer and use it in GitHub Desktop.
Object Oriented PHP
<?php
class Rippotai {
private $tate;
private $yoko;
private $takasa;
public function __construct($tate,$yoko,$takasa){
$this->tate = $tate;
$this->yoko = $yoko;
$this->takasa = $takasa;
}
public function teimennseki(){
return $this->tate * $this->yoko;
}
public function taiseki(){
return $this->tate * $this->yoko * $this->takasa;
}
}
<?php
require "sample.php";
$ripo = new Rippotai(5,5,5);
echo $ripo->teimennseki();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment