Help us understand the problem. What is going on with this article?

php アルゴリズム備忘録

文字列の切り出し

任意の文字列とその文字列の「何文字目」から「何文字」取得するかをプログラムする構文

hoge.php
<?php 
  $X = fgets(STDIN); 
  $Y = fgets(STDIN);
  echo substr($X, 0, $Y) . "\n";
?>

substr関数

文字を切り出す関数

substr(任意の文字列、 X文字目から、 Y文字切り取る) 

絶対値取得

abs関数

hoge.php
<?php 
  $num = fgets(STDIN);
  echo abs($num), PHP_EOL;

標準入力

hoge.php
$input=explode(' ',trim(fgets(STDIN)));
echo $input[0];
echo $input[1];
echo $input[2]; .............

自動的に配列に入れてくれる

大文字から小文字に変換

strtoupper関数

[string] [to] [upper]ね、、読みづら、、、、

hoge.php
<?php
  $str = trim(fgets(STDIN));
  echo strtoupper($str) . "\n";
?>
tabiojisann
WEB、システム開発に携わりたくて、現在求職中です。 現在は自動化技術(DevOps)とビッグデータ解析に興味あります。
https://www.wantedly.com/users/130056727
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした