LoginSignup
2
0

More than 5 years have passed since last update.

【PHP】アンパサンドの謎

Last updated at Posted at 2018-04-06

理想

$str = "trim&";
var_dump(rtrim($str,"&"));
// string(4) "trim"

現実

$str = "trim&";
var_dump(rtrim($str,"&"));
// string(3) "tri"

なんで?

追記

コメントで指摘をいただきました。rtrimの第二引数はリストで、渡された文字列にマッチするものを消していたのですね。なるほど...

2
0
3

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