当前位置: 首页>>代码示例>>PHP>>正文


PHP doSomething函数代码示例

本文整理汇总了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];
}
开发者ID:khaledaSabina,项目名称:php-codeigniter-tips-tricks,代码行数:31,代码来源:php_tip_trick_more.php

示例2: __construct

 public function __construct()
 {
     // do something
     if ($this->content == self::XYZ) {
         doSomething();
     }
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:7,代码来源:class.php

示例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
}
开发者ID:tanaka9230,项目名称:PhpTest,代码行数:34,代码来源:StrictTypedArgumentTest.php

示例4: f

function f()
{
    doSomething();
    // OK
    doSomethingElse();
    // NOK
    // NOK
}
开发者ID:realshadow,项目名称:sonar-php,代码行数:8,代码来源:EmptyStatementCheck.php

示例5: duplicate

/**
 * Documented function
 */
function duplicate($p1, $p2, $p3)
{
    $a = $p1 + $p2;
    $b = doSomething($p3);
    while ($p1 < $p2) {
        $p1++;
    }
    return valueOf($a) - $b;
}
开发者ID:ChristianBreitkreutz,项目名称:sonar-php,代码行数:12,代码来源:MathBis.php

示例6: KO1

function KO1()
{
    // return in else and then
    if ($a5) {
        return $a;
    } else {
        $b = doSomething();
        return $b;
    }
    $a++;
}
开发者ID:exakat,项目名称:exakat,代码行数:11,代码来源:UnreachableCode.05.php

示例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);
 }
开发者ID:extend,项目名称:wee,代码行数:16,代码来源:form-validation-typical.php

示例8: f

function f()
{
    doSomething();
}
开发者ID:ChristianBreitkreutz,项目名称:sonar-php,代码行数:4,代码来源:RightCurlyBraceStartsLineCheck.php

示例9: doSomething

<?php

doSomething(&$p1, $p2);
// OK
开发者ID:realshadow,项目名称:sonar-php,代码行数:4,代码来源:ReferenceInFunctionCallCheck.php

示例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);
}
}
}
开发者ID:kitaindia,项目名称:DGMG_online,代码行数:26,代码来源:bring_up_syldra.php

示例11: doSomething

<?php

// Functions passed by value
function doSomething($parameter)
{
    $parameter = "Hello";
    echo $Parameter;
}
$var = "Hey";
doSomething($var);
echo $var;
开发者ID:jimmy89Li,项目名称:backend,代码行数:11,代码来源:function_passed_by_value.php

示例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);
开发者ID:xtrembaker,项目名称:tests_evaluation,代码行数:13,代码来源:05+-+Reference.php

示例13: doSomething

<?php

doSomething(php_sapi_name());
// NOK
doSomething(PHP_SAPI);
// OK
doSomething($a->php_sapi_name());
// OK
开发者ID:realshadow,项目名称:sonar-php,代码行数:8,代码来源:PhpSapiNameFunctionUsageCheck.php

示例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)
开发者ID:realshadow,项目名称:sonar-php,代码行数:31,代码来源:IndentationCheck.php

示例15: doSomething

<?php

class MyTidy extends tidy
{
}
function doSomething(MyTidy $o)
{
    var_dump($o);
}
$o = new MyTidy();
var_dump($o instanceof MyTidy);
doSomething($o);
开发者ID:gleamingthecube,项目名称:php,代码行数:12,代码来源:ext_tidy_tests_bug_50558.php


注:本文中的doSomething函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。