LoginSignup
3
0

More than 5 years have passed since last update.

文字列定義を使わずにHello World

Posted at

TL;DR

  • またつまらないものをつくってしまった

レギュレーション

  • 文字リテラル(" および')、ヒアドキュメントの使用禁止
  • クラス、メソッドを作成してその名前を利用することを禁止

実際作ったの

<?php
error_reporting(E_ALL);

$h = substr(key(parse_url(1)), 3, 1); // 'path' の h
$e = substr(key(pathinfo(1)), 6, 1); // 'dirname' の e
$l = substr(array_keys(pathinfo(1))[2], 2, 1); // 'filename' の l
$o = substr(gettype(true), 1, 1); // 'bool' の o

ob_start();

http_build_query(); // '\nWarning: http_build_query() expects at least 1 parameter, 0 given in'
$buffer = trim(ob_get_contents());

$W = substr($buffer, 0, 1);
$r = substr($buffer, 2, 1);
$d = substr($buffer, 18, 1);
$space = substr($buffer, 8, 1);

ob_end_clean();

$helloWorld = ucwords($h . $e . $l . $l . $o) . $space . $W . $o . $r . $l . $d;

echo $helloWorld, PHP_EOL;
3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0