本文整理汇总了PHP中doSomething函数的典型用法代码示例。如果您正苦于以下问题:PHP doSomething函数的具体用法?PHP doSomething怎么用?PHP doSomething使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了doSomething函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doSomething
doSomething();
if ($otherCondition == true) {
doSomethingElse($someVariable);
} else {
doSomethingElse($otherVariable);
}
}
// and better than above
if ($someCondition == true) {
doSomething();
if ($otherCondition == true) {
doSomethingElse($someVariable);
doSomething($someVariable);
} else {
doSomethingElse($otherVariable);
doSomething($someVariable);
}
}
/* using some php keyword */
//using static keyword for singleton pattern
//or check data was loaded,
//
function get_data($data_key)
{
static $dataset;
if (!isset($dataset[$data_key])) {
//query database or something like that to get data
//set data to static variable
}
return $dataset[$data_key];
}
示例2: __construct
public function __construct()
{
// do something
if ($this->content == self::XYZ) {
doSomething();
}
}
示例3: testStrictTypedArgument
function testStrictTypedArgument()
{
doEverything(123);
// ok
doEverything(123.4);
// ok
doEverything("123");
// ok
doEverything("123.4");
// ok
doEverything("abc");
// ok
doSomething(123);
// ok
//doSomething(123.4); // Type error: ...must be of the type integer, float given
//doSomething("123"); // Type error: ...must be of the type integer, string given
//doSomething("123.4"); // Type error: ...must be of the type integer, string given
//doSomething("abc"); // Type error: ...must be of the type integer, string given
doEveryLittleThing(123);
// ok
doEveryLittleThing(123.4);
// ok
//doEveryLittleThing("123"); // Type error: ...must be of the type float, string given
//doEveryLittleThing("123.4"); // Type error: ...must be of the type float, string given
//doEveryLittleThing("abc"); // Type error: ...must be of the type float, string given
//doAnything(123); // Type error: ...must be of the type string, integer given
//doAnything(123.4); // Type error: ...must be of the type string, float given
doAnything("123");
// ok
doAnything("123.4");
// ok
doAnything("abc");
// ok
}
示例4: f
function f()
{
doSomething();
// OK
doSomethingElse();
// NOK
// NOK
}
示例5: duplicate
/**
* Documented function
*/
function duplicate($p1, $p2, $p3)
{
$a = $p1 + $p2;
$b = doSomething($p3);
while ($p1 < $p2) {
$p1++;
}
return valueOf($a) - $b;
}
示例6: KO1
function KO1()
{
// return in else and then
if ($a5) {
return $a;
} else {
$b = doSomething();
return $b;
}
$a++;
}
示例7: defaultEvent
protected function defaultEvent($aEvent)
{
$oForm = new weeForm('myform', 'update');
if (!empty($aEvent['post'])) {
$aData = $oForm->filter($aEvent['post']);
try {
$oForm->validate($aData);
// Validation success: process the form
doSomething($aData);
} catch (FormValidationException $e) {
$oForm->fill($aData);
$oForm->fillErrors($e);
}
}
$this->set('form', $oForm);
}
示例8: f
function f()
{
doSomething();
}
示例9: doSomething
<?php
doSomething(&$p1, $p2);
// OK
示例10: checkIdPass
function checkIdPass(){
$id =$_POST["eggId"];
$pass = $_POST["eggPassword"];
$link = mysql_connect('mysql010.phy.lolipop.lan', 'ユーザ名','パスワード');
if (!$link) {
die('接続失敗です。'.mysql_error());
}
$db_selected = mysql_select_db('LAA0535115-dbname', $link);
if (!$db_selected){
die('データベース選択失敗です。'.mysql_error());
}
mysql_set_charset('utf8');
$result = mysql_query('SELECT * FROM db_user');
if (!$result) {
die('クエリーが失敗しました。'.mysql_error());
}
while ($row = mysql_fetch_assoc($result)) {
if($id == $row['id'] && $pass == $row['pass']){
$name = $row['name'];
print"<br>「・・・。(こんにちは、";
print $name;
print"さん。)」";
doSomething(1);
}
}
}
示例11: doSomething
<?php
// Functions passed by value
function doSomething($parameter)
{
$parameter = "Hello";
echo $Parameter;
}
$var = "Hey";
doSomething($var);
echo $var;
示例12: doSomething
<?php
/**
* What would be the value of $a and $b at the end of the program ?
*/
function doSomething(&$arg)
{
$return = $arg;
$arg += 1;
return $return;
}
$a = 3;
$b = doSomething($a);
示例13: doSomething
<?php
doSomething(php_sapi_name());
// NOK
doSomething(PHP_SAPI);
// OK
doSomething($a->php_sapi_name());
// OK
示例14: doSomething
<?php
/**
* Function calls arguments indentation
*/
doSomething($p1, $p2);
doSomething($p1, $p2);
doSomething($p1, $p2);
// NOK
doSomething($p1, something($p1, $p2, $p3, $p4));
doSomething($p1, array($p1, $p2), $p2);
doSomething($p1, $p2);
// OK
doSomething($p1, $p2);
doSomething(anotherThing($p1, $p2, $p2));
/**
* Method declaration argument indentation
*/
function f($p1, $p2)
{
}
function g($p1, $p2)
{
}
function h($p1, $p2)
{
}
function j($p1, $p2)
{
}
function k($p1, $p2)
示例15: doSomething
<?php
class MyTidy extends tidy
{
}
function doSomething(MyTidy $o)
{
var_dump($o);
}
$o = new MyTidy();
var_dump($o instanceof MyTidy);
doSomething($o);