0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

paiza(PHP)でよく使う処理をまとめてみた

Last updated at Posted at 2021-12-18

#はじめに
rubyからスタートして約4か月。最近は次の仕事でよく使われるPHPを勉強している。paizaでよく使われる入力値の仕方をまとめてみました。

###➀入力値の取得
####ruby

hoge = gets

####PHP

$hoge = fgets(STDIN);

###➁空白や改行が与えられる場合
####ruby

hoge = gets.chomp

####PHP

$hoge = trim(fgets(STDIN));

###➂➁を配列で取得したい場合
####ruby

hoge = gets.chomp.split

###PHP

$hoge = explode(" ",trim(fgets(STDIN)));

##おわりに
学習していくうちに追加していこうと思います。
間違っていたらご指摘お願いします(笑)

てかセミコロンのつけ忘れてしまう。。

0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?