Пример #1
0
 public function handleKPIClick2($source, $targets, $params)
 {
     $this->log('Yo', 44);
     // $kpi2 = $this->getComponentByID("kpi1");
     // $kpi2->setValue (55);
     // $kpi2->setCaption ("Hello to you too");
     hello();
     $this->log('A', $params);
 }
Пример #2
0
 public function method1()
 {
     $x = 1;
     echo "method1\n";
     if ($x) {
         doCall("hello");
         return hello();
     }
     return 0;
 }
Пример #3
0
function pleac_Introduction()
{
    // Since defined at outermost scope, $greeted may be considered a global variable
    $greeted = 0;
    // ------------
    // Must use, 'global', keyword to inform functions that $greeted already exists as
    // a global variable. If this is not done, a local variable of that name is implicitly
    // defined
    function howManyGreetings()
    {
        global $greeted;
        return $greeted;
    }
    function hello()
    {
        global $greeted;
        $greeted++;
        echo "high there!, this procedure has been called {$greeted} times\n";
    }
    // ------------
    hello();
    $greetings = howManyGreetings();
    echo "bye there!, there have been {$greetings} greetings so far\n";
}
Пример #4
0
<html>
    <head>
        <title>
            include php file
        </title>
    </head>
    <body>
    <?php 
include "include_func.php";
?>
    <?php 
hello(everyone);
hi(shanu);
add(10, 25);
add(15);
?>
    </body>
</html>
Пример #5
0
<?php

header("content-type:text/html;charset=utf-8");
function hello()
{
    //$a = 1;
    static $a = 1;
    $a++;
    echo "{$a}<br>";
}
hello();
//2
hello();
//3
hello();
//4
Пример #6
0
        return "Hello, {$name}";
    }
}
configure(function () {
    $test = 'test';
    set(array('views' => dirname(__FILE__) . '/templates'));
});
after(function () {
    echo " AFTER!";
});
get("/", function () {
    render('form', array('locals' => array('test' => 'test')));
});
template("form", function ($locals) {
    echo '<form method="post">
	        	<input type="submit" value="submit" />
	        	</form>';
});
post("/", function () {
    echo "post";
});
get("/hello/:name", function ($params) {
    pass('/hello/' . $params['name'] . '/test');
});
get("/hello/:name/test", function ($params) {
    echo hello($params['name']);
    halt(404, 'Go away', array('Content-Type' => 'text/plain'));
});
not_found(function () {
    echo "This file wasn't found, yo!";
});
Пример #7
0
// Create function with parameter arr
function hello($arr)
{
    //if this paramter is an array, go through each item in the array and assign it a value of $names
    if (is_array($arr)) {
        foreach ($arr as $names) {
            echo "Hello {$names}<br>";
        }
    } else {
        echo "Hello friends!";
    }
}
// reverse the array before passing it as an argument into hello function, for no particular reason
$names = array('Tom', 'Jerry', 'Shawn');
$reversed = array_reverse($names);
hello($reversed);
// Practicing inheritence
class Fish
{
    // The class's variables are called properties
    public $common_name;
    public $flavor;
    public $record_weight;
    // The class's constructor will allow us to call this method on each newly-created object,
    //so every new instance of the object can have new values.
    // Here we assign the class's properties to each of the parameters
    function __construct($name, $flavor, $record)
    {
        $this->common_name = $name;
        $this->flavor = $flavor;
        $this->record_weight = $record;
Пример #8
0
<?php

include './vendor/autoload.php';
from('./lib.php')->import('hello');
// is Ok
hello('Fabien');
// throw an fatal error
by('Fabien');
Пример #9
0
<?
	return hello();

	function hello() {
		if ($_SESSION['status'] != 'ghost') {
			$return .= 'Добро пожаловать в Adeptx Driver, ' . $_SESSION['nickname'] . "!\n";
		} else {
			$return .= "Добро пожаловать в Adeptx Driver! Для начала полноценной работы авторизуйтесь в системе (auth) или воспользуйтесь справкой (help).\n\nP.S.: вы можете использовать команду hello для проверки того, авторизованы вы или нет (если вы аторизованы она обратиться к вам по нику, если нет - вы увидите это сообщение) или команду get my status, сейчас ваш статус ghost.\n";
		}

		return $return;
	}
<?php

include dirname(__FILE__) . DIRECTORY_SEPARATOR . "timeout_config.inc";
set_time_limit($t);
function hello($t)
{
    echo "call";
    busy_wait($t * 2);
}
hello($t);
?>
never reached here
Пример #11
0
<?php

/**
 * 電子書籍『はじめてのフレームワークとしてのFuelPHP 第2版』の一部です。
 *
 * @version    1.1.0
 * @author     Kenji Suzuki <https://github.com/kenjis>
 * @license    MIT License
 * @copyright  2014 Kenji Suzuki
 * @link       https://github.com/kenjis/fuelphp1st-2nd
 */
require __DIR__ . '/hello.php';
function assertTrue($condition)
{
    if (!$condition) {
        throw new Exception('Assertion failed.');
    }
}
$test = hello();
$expected = 'Hello World!';
assertTrue($test === $expected);
Пример #12
0
<html>
  <head>
    <!-- created by John kagga johnkagga.me -->
      <title> Include </title>
  </head>
    <body>
      <?php 
// including a file
//include is mainy used for not very essential files
include "included_func.php";
//require is used for essential files like files containg functions, since it throws an error when a file is not found.
require "included_func.php";
// not to include a file more than once this function is used
require_once "included_func.php";
?>


      <?php 
hello("Cedat");
?>
    </body>
</html>
Пример #13
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Includes</title>
</head>
<body>
<?php 
// won't throw an error if it's not there
// include("included_func.php");
//will throw an error if it can't find it, use this for
// functions
require "included_func.php";
//also have require_once which will use it once
hello("Glen Roberts");
?>
</body>
</html>
Пример #14
0
}
error_reporting(0);
$endpoint = 'http://svcs.ebay.com/services/search/FindingService/v1';
$version = '1.0.0';
$appid = 'chanduiv-1959-4032-b1f0-133f017b83f9';
$globalid = 'EBAY-US';
$pric = get_object_vars($hh->productBaseInfo->productAttributes->sellingPrice);
$pri = $pric['amount'] - 113;
$desc = $hh->productBaseInfo->productAttributes->productDescription;
if (isset($_GET['product_name'])) {
    $query = $_GET['product_name'];
    hello($query, $endpoint, $version, $appid, $globalid, $pri, $desc);
} else {
    if (isset($_GET['id'])) {
        $query = $hh->productBaseInfo->productAttributes->title;
        hello($query, $endpoint, $version, $appid, $globalid, $pri, $desc);
    } else {
        echo "<center><h1 class='text-warning'>No Products found</h1></center>";
    }
}
function hello($query, $endpoint, $version, $appid, $globalid, $pri, $desc)
{
    $safequery = urlencode($query);
    $i = '0';
    $apicall = "{$endpoint}?";
    $apicall .= "OPERATION-NAME=findItemsByKeywords";
    $apicall .= "&SERVICE-VERSION={$version}";
    $apicall .= "&SECURITY-APPNAME={$appid}";
    $apicall .= "&GLOBAL-ID={$globalid}";
    $apicall .= "&keywords={$safequery}";
    $apicall .= "&paginationInput.entriesPerPage=1";
Пример #15
0
<?php

function say_hello()
{
    return "Hi, there";
}
say_hello();
//Nothing show
echo say_hello();
// Display Hi, there
/*
 * Passing parameter
 * */
function hello($name)
{
    return "Hello, {$name}";
}
echo hello("Biswajit");
function array_pluck($toPluck, $arr)
{
    $ret = array();
    foreach ($arr as $item) {
        $ret[] = $item[$toPluck];
    }
    return $ret;
}
$people = array(array('name' => 'Biswajit', 'age' => '27', 'occupation' => 'student'), array('name' => 'Jeffery', 'age' => '50', 'occupation' => 'Web Developer'), array('name' => 'Joe', 'age' => '50', 'occupation' => 'Marketing'));
print_r(array_pluck('name', $people));
Пример #16
0

<?php 
//関数とは、あるまとまった処理を行い、値を返すものです。
//関数の作り方:関数を作るには「function 関数名(引数1、引数2、...){ 処理 }」という書き方をします。
//関数を呼び出す際、関数に任意の値を渡して処理させることができます。この値を「引数」と呼びます。
//なお、関数名、引数の名前は自由につけることが出来ます。
//なぜこれが必要なのか「 $x = ''」;
$x = '';
//もしnicknameがPOST送信されたら
if (isset($_POST['nickname'])) {
    //$_POST['nickname']を$xとし、
    $x = hello($_POST['nickname']);
}
function hello($nickname)
{
    return $nickname;
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
<meta http-equiv="UTF-8">
      <title>掲示板</title>
     
     </head>
    <body>
        <form method="post" action="">
            <input name="nickname" type="text" style="width:100px"/>
             <input type="submit" value="あいさつ">
Пример #17
0

<?php 
//Return Values
function hello($name)
{
    if ($name == "Mike") {
        return "Hello, Mike!<br>";
    } else {
        return "Hello, Stranger!<br>";
    }
}
//assign function and return to var
$greeting = hello("Mike");
//echo var
echo $greeting;
//add integers
function add_up($a, $b)
{
    return $a + $b;
}
$value = add_up(2, 4);
//print_r to print array
//print_r($value);
echo $value;
echo "<br>";
//VARIABLE FUNCTIONS
function answer()
{
    return 42;
}
Пример #18
0
<?php

header('content-type:text/html;charset=utf-8');
//冒泡排序例题
$arr = array(70, 5, -31, 4, 62, 17, 378, 45.7);
//将数值从小到达排序
//外层循环
function hello(&$arr)
{
    //加地址符,避免内存开辟新的空间
    $temp = 0;
    //中间变量
    for ($i = 0; $i < count($arr); $i++) {
        for ($j = 0; $j < count($arr) - 1 - $i; $j++) {
            //说明前面的数比后面的数大,就要交换
            if ($arr[$j] > $arr[$j + 1]) {
                $temp = $arr[$j];
                $arr[$j] = $arr[$j + 1];
                $arr[$j + 1] = $temp;
            }
        }
    }
    print_r($arr);
    echo '<hr>';
}
hello($arr);
//输出
print_r($arr);
Пример #19
0
$greet('PHP');
function hello2($var = "papajohn", $var2 = "panagiota")
{
    echo "hello {$var} + {$var2}!";
    echo "\n";
}
$v = array("me", "you");
hello2($v[0], $v[1]);
function hello($var = "papajohn", $n = NULL)
{
    echo "hello {$var}!";
    echo "\n";
    return array(true);
}
$r1 = hello("yiannis");
$r2 = hello();
if ($r1[0] && $r2[0]) {
    echo "Success!\n";
}
##variable functions
function foo()
{
    echo "In foo()<br />\n";
}
function bar($arg = '')
{
    echo "In bar(); argument was '{$arg}'.<br />\n";
}
// This is a wrapper function around echo
function echoit($string = "default")
{
Пример #20
0
<?php

//vaikev��rtus kui nimi puudub
function hello($name = "tundmatu kasutaja")
{
    echo "hello" . $name;
}
$user = "******";
hello($user);
Пример #21
0
function nc_osc_uninstall()
{
    hello();
}
 public function demoAction()
 {
     $em = $this->getEntityManager();
     $em = parent::getEntityManager();
     hello();
 }
Пример #23
0
<?php

function hello()
{
    hh\asm('
    String "Hello World"
    RetC
  ');
}
var_dump(hello());
Пример #24
0
<?php

$text = "ff";
function hello($name = "guest", $count = null)
{
    if ($count == +null) {
        $count = rand(1, 10);
    }
    return "Hell" . str_repeat("o", $count) . " " . $name;
}
$message = hello("fdssd", 0);
print $message;
Пример #25
0
<?php

include "included_functions.php";
include "included_header.php";
?>


The header has been included.

<br />

<?php 
echo hello("Everyone");
?>
<br />
	</body>
</html>	

Пример #26
0
<?php

//Arguments for functions
//Always start functions with lowercase letter
//Generalize it... use it as a template
function hello($person, $age, $email)
{
    echo "Hello, {$person}. How are you today? <br />";
    echo "Are you still {$age} years old?<br />";
    echo "Your email is: {$email}";
}
hello("Sebastian", 30, "*****@*****.**");
Пример #27
0
//Call the function
hello("Hampton");*/
function hello($arr = 'friends')
{
    if (is_array($arr)) {
        foreach ($arr as $name) {
            //<br> in echo for new line
            echo "Hello, {$name}. How's it going!<br>";
        }
    } else {
        echo "Hello, {$arr}, how's it going?";
    }
}
$names = array('Bob', 'Shelly');
hello($names);
$current_user = "******";
function is_mike()
{
    //global variable outside of function used in function
    global $current_user;
    if ($current_user == 'Mike') {
        echo '<html>It is Mike </html>';
    } else {
        echo 'It is not Mike';
    }
}
is_mike();
//PHP Function Default Arguments
//optional argument = NULL
//Check with if statement
<?php

// normal function
function say($helloParam)
{
    echo $helloParam;
}
// normal function which uses an anonymous function
function hello($hellAnonymous, $text)
{
    echo $hellAnonymous($text);
}
// anonymous function
$hello = function ($param) {
    echo $param;
};
echo say("hello word!");
$hello("hello word!");
hello($hello, "hello word!");
Пример #29
0
<?php

/**
 * 電子書籍『はじめてのフレームワークとしてのFuelPHP 第2版』の一部です。
 *
 * @version    1.1.0
 * @author     Kenji Suzuki <https://github.com/kenjis>
 * @license    MIT License
 * @copyright  2014 Kenji Suzuki
 * @link       https://github.com/kenjis/fuelphp1st-2nd
 */
require __DIR__ . '/hello_func.php';
echo hello();
Пример #30
0
<!DOCTYPE html>
<html lang ="ja">
<head>
<meta charset="UTF-8">
<title>HW</title>
</head>
<body>
	<!-- formで$POSTに送る→$_POSTから引っ張ってくる -->
	<form action="" method="post">
	<input type="text" name="comment" /><br />
	<input type="submit" value="送信"/>
	</form>
	Hello!!
	<?php 
if (isset($_POST['comment'])) {
    $comment = $_POST['comment'];
    function hello($comment)
    {
        return htmlspecialchars($comment);
    }
}
echo hello($comment);
?>
	さん
</body>
</html>