LoginSignup
3
3

More than 5 years have passed since last update.

「PHP」関数を使ってみる。

Last updated at Posted at 2014-03-21

PHPに組み込まれた「関数」を使うと、文字列や数値の加工を含め、さまざまな処理を組み立てる事が出来ます。
実際どれくらいの関数が使えるかというと、、なんと1000を超える関数がPHPでは使用出来ます。

round関数(四捨五入する関数)を使って見てみましょう。

・関数の呼び出し方↓round関数を例に書いてみました。

kansuu01.png

このような順番で書きます。

結果は

<?php
//「123.456」を小数点以下第1位で四捨五入する
$a = round(123.456, 1);
echo $a;  //123.5
?>

以下結果↓
kansuu002.png

PHP関数の使い方を調べるには(使える関数をどこで探すのか)

どの処理でどの関数を使うのか?、、これについては後々紹介します。
しかし、取り急ぎ「どんな関数があるのか?」を知りたいときには、、、

「PHPの公式ホームページ」にある「PHPマニュアル」を参照する事が一般的であるようです。
・PHPマニュアルのURL↓
http://www.php.net/manual/ja/

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