Skip to content

Instantly share code, notes, and snippets.

<?php
function hoge(&$str) {
$str = "hoge";
}
$my_str = "Aaaaaa";
echo $my_str.PHP_EOL; // "Aaaaaa"
<?php
class Hoge {
public function __toString() {
return get_class($this);
}
public static function hhh() {
echo "hoge!!!\n";
}
}
class Task
class Hoge
def self.hoge
puts "hoge!!!!"
end
end
module Foo
def foo
Hoge.hoge
@rightgo09
rightgo09 / array_shift.php
Created February 3, 2015 02:44
array_shiftした後の配列は添字がちゃんと0から始まる.
<?php
$arr = array(4,1,3);
print_r($arr);
$a = array_shift($arr);
print_r($arr);
array_unshift($arr, $a);
print_r($arr);
//Array
//(
<?php
class Hoge {
private $h;
public function __construct(&$h) {
$this->h &= $h;
}
public function hhh($str) {
$this->h["str"] = $str;
}
<?php
abstract class Goo {
public static function g() {
echo "goooooo!\n";
}
}
Goo::g(); // goooooo!
@rightgo09
rightgo09 / a.php
Last active August 29, 2015 14:14
<?php
class Hoge {
public function foo() {
$this->bar();
}
public function bar() {
echo "Hoge::bar()\n";
}
}
<?php
abstract class ItemShop {
public function order_item($type) {
//$item = $this->factory->create_item($type);
$item = $this->create_item($type);
if ($item->is_expired()) return;
if ($item->is_sold_out()) return;
if ($item->on_sale()) {
$item->sale_price();
<?php
require_once "./simpleitemfactory.php";
class ItemShop {
private $factory;
public function __construct(SimpleItemFactory $factory) {
$this->factory = $factory;
}
@rightgo09
rightgo09 / create_issue.json
Last active August 29, 2015 14:12
JIRA API JSON
{
"fields": {
"project":
{
"key": "TEST"
},
"summary": "REST ye merry gentlemen.",
"description": "Creating of an issue using project keys and issue type names using the REST API",
"issuetype": {
"name": "Bug"