コード例 #1
0
ファイル: functions_03.php プロジェクト: Remekgc/Vef
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Simple function with argument - no return value</title>
</head>

<body>
<?php 
function sayHi($name)
{
    echo "Hi, {$name}!";
}
$visitor = 5;
sayHi($visitor);
?>
</body>
</html>
コード例 #2
0
<?php

namespace btvphp\stuff;

function sayHi()
{
    return 'Hi';
}
echo \btvphp\stuff\sayHi();
// Hi
echo sayHi();
// Hi
コード例 #3
0
ファイル: index.php プロジェクト: hiroki0325/geechscamp
//	"taguchi" => 200,
//	"fkoji" => 800,
//	"dotinstall" => 600,
// ];
//
// var_dump($sales["fkoji"]); //800
// $sales["fkoji"] = 900;
// var_dump($sales["fkoji"]); //900
//foreach ($sales as $key => $value){
//	echo "($key) $value ";
//}
// $colors = ["red","blue","pink"];
// var_dump($colors[1]); //blue
// foreach ($colors as $value){
//	echo "$value ";
//}
// foreach if while for コロン構文
// foreach ($colors as $value):
//				 echo "$value ";
// endforeach;
// 関数
function sayHi($name = "taguchi")
{
    //echo "hi!".$name;
    return "hi! " . $name;
}
//sayHi("Tom");
//sayHi("Bob");
//sayHi();
$s = sayHi();
var_dump($s);
コード例 #4
0
ファイル: routes.php プロジェクト: wyrover/lenda-api
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
use App\Events\LoanWasCreated;
use App\Events\UserWasCreated;
use App\Loan;
use Carbon\Carbon;
Route::get('/', function () {
    return sayHi();
    /*	$record = Loan::create([
    		'applicant_id' => 4,
    		'farmer_id' => 12,
    		'app_date' => Carbon::now(),
    		'default_due_date' => Carbon::createFromFormat('Y-m-d','2015-12-15'),
    		'due_date' => Carbon::createFromFormat('Y-m-d','2015-12-15'),
    		'loan_type_id' => 2,
    		'status_id' => 1,
    		'crop_year' => '2015',
    		'season' => 'S',
    		'loc_id' => 5,
    		'region_id' => 3,
    		'user_id' => 3
    	]);
    	event(new LoanWasCreated($record));*/
コード例 #5
0
ファイル: Class 3.php プロジェクト: hwaunhwan/PHPIntermediate
?>
</p>

<br>
<h2>Make your own functions</h2>
<br>
<?php
function sayHi ($person){//you can give more than one attributes like age, race etc
    echo "Hello, $person! How are you?<br>";
}

sayHi("Matt");
sayHi("Simon");
sayHi("JK");
sayHi("John");
sayHi("Sarah");

?>

<br>
<?php //return
function sayBye ($person){
    return "Bye, $person! <br>";
}

sayBye("1"); // doesn't show it online because it just used "return"
echo sayBye ("2");


?>
コード例 #6
0
ファイル: functions_01.php プロジェクト: Remekgc/Vef
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Simple function with no arguments</title>
</head>

<body>
<?php 
function sayHi()
{
    echo 'Hi!';
}
sayHi();
?>
</body>
</html>