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 5 years have passed since last update.

PHPの関数(引数と戻り値)

0
Last updated at Posted at 2020-01-09
<?php
// 関数の作成

function sum($a, $b) {
    echo $a + $b;
}

関数sumの完成!

関数の呼び出し

sum();

※()を忘れないように注意。
関数を変数として定義。

$num1 = sum(3, 2);
echo $num1."\n";
$num2 = sum(300, 400);
echo $num2."\n";
?>

関数はとっても便利!

ちなみに、 "\n"はテキストでの改行を表しています。

参考になるWEBページ:https://www.php.net/manual/ja/functions.user-defined.php

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?