本文整理汇总了PHP中sub函数的典型用法代码示例。如果您正苦于以下问题:PHP sub函数的具体用法?PHP sub怎么用?PHP sub使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sub函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: pad
/**
* UTF-8 aware alternative to str_pad.
*
* $pad_str may contain multi-byte characters.
*
* @author Oliver Saunders <[email protected]>
* @package php-utf-8
* @subpackage functions
* @see http://www.php.net/str_pad
* @uses utf8_substr
*
* @param string $input
* @param int $length
* @param string $pad_str
* @param int $type (same constants as str_pad)
*
* @return string
*/
function pad($input, $length, $pad_str = ' ', $type = STR_PAD_RIGHT)
{
$input_len = len($input);
if ($length <= $input_len) {
return $input;
}
$pad_str_len = len($pad_str);
$pad_len = $length - $input_len;
if ($type == STR_PAD_RIGHT) {
$repeat_times = ceil($pad_len / $pad_str_len);
return sub($input . str_repeat($pad_str, $repeat_times), 0, $length);
}
if ($type == STR_PAD_LEFT) {
$repeat_times = ceil($pad_len / $pad_str_len);
return sub(str_repeat($pad_str, $repeat_times), 0, floor($pad_len)) . $input;
}
if ($type == STR_PAD_BOTH) {
$pad_len /= 2;
$pad_amount_left = floor($pad_len);
$pad_amount_right = ceil($pad_len);
$repeat_times_left = ceil($pad_amount_left / $pad_str_len);
$repeat_times_right = ceil($pad_amount_right / $pad_str_len);
$padding_left = sub(str_repeat($pad_str, $repeat_times_left), 0, $pad_amount_left);
$padding_right = sub(str_repeat($pad_str, $repeat_times_right), 0, $pad_amount_right);
return $padding_left . $input . $padding_right;
}
trigger_error('utf8_str_pad: Unknown padding type (' . $type . ')', E_USER_ERROR);
}
开发者ID:corpsee,项目名称:php-utf-8,代码行数:46,代码来源:str_pad.php
示例2: sub
function sub($items, $id, $count)
{
$count++;
echo '<ul>';
foreach ($items as $item) {
if ($item['parent'] == $id) {
echo '<li><label><input type="checkbox" value="' . $item['id'] . '">' . $item['title'] . '</label></li>';
sub($items, $item['id'], $count);
}
}
echo '</ul>';
}
开发者ID:ahadabasi,项目名称:edu7-01,代码行数:12,代码来源:addworksample.php
示例3: cspn
/**
* UTF-8 aware alternative to strcspn.
*
* Find length of initial segment not matching mask.
*
* @package php-utf-8
* @subpackage functions
* @see http://www.php.net/strcspn
* @uses utf8_strlen
* @uses utf8_substr
*
* @param string $str
* @param string $mask
* @param integer $start
* @param integer $length
*
* @return integer|null
*/
function cspn($str, $mask, $start = null, $length = null)
{
if (empty($mask) || strlen($mask) == 0) {
return null;
}
$mask = preg_replace('!([\\\\\\-\\]\\[/^])!', '\\\\${1}', $mask);
if ($start !== null || $length !== null) {
$str = sub($str, $start, $length);
}
preg_match('/^[^' . $mask . ']+/u', $str, $matches);
if (isset($matches[0])) {
return len($matches[0]);
}
return 0;
}
开发者ID:corpsee,项目名称:php-utf-8,代码行数:33,代码来源:strcspn.php
示例4: checkTokenError
/**
* Проверка пользовательских данных, полученных по токену
*/
protected function checkTokenError()
{
if (!is_array($this->u_data)) {
$this->sendMessage(array('title' => $this->user->lang['ULOGIN_AUTH_ERROR'], 'msg' => $this->user->lang['ULOGIN_WRONG_USER_DATA_ERROR'], 'type' => 'error'));
return false;
}
if (isset($this->u_data['error'])) {
$strpos = strpos($this->u_data['error'], 'host is not');
if ($strpos) {
$this->sendMessage(array('title' => $this->user->lang['ULOGIN_AUTH_ERROR'], 'msg' => sprintf($this->user->lang['ULOGIN_HOST_ADDRESS_ERROR'], sub($this->u_data['error'], intval($strpos) + 12)), 'type' => 'error'));
return false;
}
switch ($this->u_data['error']) {
case 'token expired':
$this->sendMessage(array('title' => $this->user->lang['ULOGIN_AUTH_ERROR'], 'msg' => $this->user->lang['ULOGIN_TOKEN_EXPIRED_ERROR'], 'type' => 'error'));
break;
case 'invalid token':
$this->sendMessage(array('title' => $this->user->lang['ULOGIN_AUTH_ERROR'], 'msg' => $this->user->lang['ULOGIN_INVALID_TOKEN_ERROR'], 'type' => 'error'));
break;
default:
$this->sendMessage(array('title' => $this->user->lang['ULOGIN_AUTH_ERROR'], 'msg' => "<i>ERROR</i>: " . $this->u_data['error'], 'type' => 'error'));
}
return false;
}
if (!isset($this->u_data['identity'])) {
$this->sendMessage(array('title' => $this->user->lang['ULOGIN_AUTH_ERROR'], 'msg' => sprintf($this->user->lang['ULOGIN_NO_VARIABLE_ERROR'], 'identity'), 'type' => 'error'));
return false;
}
if (!isset($this->u_data['email'])) {
$this->sendMessage(array('title' => $this->user->lang['ULOGIN_AUTH_ERROR'], 'msg' => sprintf($this->user->lang['ULOGIN_NO_VARIABLE_ERROR'], 'email'), 'type' => 'error'));
return false;
}
return true;
}
开发者ID:mike-a-b,项目名称:crossfit,代码行数:37,代码来源:main.php
示例5: sub
function sub($items, $id, $count)
{
$count++;
foreach ($items as $item) {
if ($item['parent'] == $id) {
echo '<tr class="category-wrap-main">
<td><input value="' . $item['id'] . '" type="checkbox"/></td>
<td>';
for ($i = 0; $i < $count; $i++) {
echo " - ";
}
echo $item['title'] . "</a></td>";
echo '<td>' . $item['describe_category'] . '</td>
<td>
<a href="" class="quickedit-btn">ویرایش سریع</a> |
<a href="update-catws.php?id=' . $item['id'] . '" class="lupwsc">ویرایش</a> |
<a href="" class="quickdelete-btn">حذف</a>
</td>
</tr>';
echo '<tr class="quickedit">
<td colspan="5">
<fieldset>
<h4>ویرایش سریع</h4>
<div>
<div class="col-md-1"><label for="">نام</label></div>
<div class="col-md-11">
<input type="text" class="ptitle" value="' . $item['title'] . '"/>
</div>
</div>
<div>
<div class="col-md-1"><label class="wrap-txt-quick-edit" for="">توضیح</label></div>
<div class="col-md-11">
<input type="text" class="ptitle" value="' . $item['describe_category'] . '"/>
</div>
</div>
<div class="quick-edit-wrap-btn">
<input type="submit" class="btn btn-default btn-sm quick-edit-cancel-btn" value="لغو">
<input type="submit" class="btn btn-primary text-left btn-sm quick-update" value="بروز رسانی">
</div>';
sub($items, $item['id'], $count);
}
}
}
开发者ID:ahadabasi,项目名称:edu7-01,代码行数:44,代码来源:insert-catws.php
示例6: ulogin_check_token_error
/**
* Проверка пользовательских данных, полученных по токену
* @param $u_user - пользовательские данные
* @return bool
*/
function ulogin_check_token_error($u_user)
{
if (!is_array($u_user)) {
wp_die(__("<b>Ошибка работы uLogin:</b></br></br>" . "Данные о пользователе содержат неверный формат."), 'uLogin error', array('back_link' => true));
return false;
}
if (isset($u_user['error'])) {
$strpos = strpos($u_user['error'], 'host is not');
if ($strpos) {
wp_die(__("<b>Ошибка работы uLogin:</b></br></br>" . "<i>ERROR</i>: адрес хоста не совпадает с оригиналом") . sub($u_user['error'], intval($strpos) + 12), 'uLogin error', array('back_link' => true));
}
switch ($u_user['error']) {
case 'token expired':
wp_die(__("<b>Ошибка работы uLogin:</b></br></br>" . "<i>ERROR</i>: время жизни токена истекло"), 'uLogin error', array('back_link' => true));
break;
case 'invalid token':
wp_die(__("<b>Ошибка работы uLogin:</b></br></br>" . "<i>ERROR</i>: неверный токен"), 'uLogin error', array('back_link' => true));
break;
default:
wp_die(__("<b>Ошибка работы uLogin:</b></br></br>" . "<i>ERROR</i>: ") . $u_user['error'], 'uLogin error', array('back_link' => true));
}
return false;
}
if (!isset($u_user['identity'])) {
wp_die(__("<b>Ошибка работы uLogin:</b></br></br>" . "В возвращаемых данных отсутствует переменная <b>identity</b>."), 'uLogin error', array('back_link' => true));
return false;
}
return true;
}
开发者ID:ultr0,项目名称:TM-FreeTV,代码行数:34,代码来源:ulogin.php
示例7: div
function div($x, $y)
{
return lt($x, $y) ? 0 : add(1, div(sub($x, $y), $y));
}
开发者ID:emkay,项目名称:php-phant,代码行数:4,代码来源:math.php
示例8: checkTokenError
/**
* Проверка пользовательских данных, полученных по токену
*/
protected function checkTokenError()
{
if (!is_array($this->u_data)) {
$this->sendMessage(array('title' => 'ulogin_auth_error', 'msg' => 'ulogin_wrong_user_data_error', 'type' => 'error'));
return false;
}
if (isset($this->u_data['error'])) {
$strpos = strpos($this->u_data['error'], 'host is not');
if ($strpos) {
$this->sendMessage(array('title' => 'ulogin_auth_error', 'msg' => array('ulogin_host_address_error', sub($this->u_data['error'], intval($strpos) + 12)), 'type' => 'error'));
return false;
}
switch ($this->u_data['error']) {
case 'token expired':
$this->sendMessage(array('title' => 'ulogin_auth_error', 'msg' => 'ulogin_token_expired_error', 'type' => 'error'));
break;
case 'invalid token':
$this->sendMessage(array('title' => 'ulogin_auth_error', 'msg' => 'ulogin_invalid_token_error', 'type' => 'error'));
break;
default:
$this->sendMessage(array('title' => 'ulogin_auth_error', 'msg' => "<i>ERROR</i>: " . $this->u_data['error'], 'type' => 'error'));
}
return false;
}
if (!isset($this->u_data['identity'])) {
$this->sendMessage(array('title' => 'ulogin_auth_error', 'msg' => array('ulogin_no_variable_error', 'identity'), 'type' => 'error'));
return false;
}
if (!isset($this->u_data['email'])) {
$this->sendMessage(array('title' => 'ulogin_auth_error', 'msg' => array('ulogin_no_variable_error', 'email'), 'type' => 'error'));
return false;
}
if (!isset($this->u_data['first_name'])) {
$this->sendMessage(array('title' => 'ulogin_auth_error', 'msg' => array('ulogin_no_variable_error', 'first_name'), 'type' => 'error'));
return false;
}
if (!isset($this->u_data['last_name'])) {
$this->sendMessage(array('title' => 'ulogin_auth_error', 'msg' => array('ulogin_no_variable_error', 'last_name'), 'type' => 'error'));
return false;
}
return true;
}
开发者ID:vadimtimofieiev,项目名称:ulogin-OpenCart,代码行数:45,代码来源:ulogin.php
示例9: sub
public function sub($other)
{
return sub($this, $other);
}
开发者ID:Vinceveve,项目名称:php-rql,代码行数:4,代码来源:misc.php
示例10: soma
<pre><?php
include 'cal.php';
echo '5 + 2= ' . soma(5, 2) . '<br>';
echo '5 - 2= ' . sub(5, 2) . '<br>';
echo '5 / 2= ' . div(5, 2) . '<br>';
echo '5 * 2= ' . mult(5, 2) . '<br>';
echo '5 + 2 * 3= ' . soma(5, mult(2, 3)) . '<br>';
echo '8 - 3 + 5= ' . soma(sub(8, 3), 5) . '<br>';
echo '9 / 3 + 4 * 2= ' . soma(div(9, 3), mult(4, 2)) . '<br>';
?>
</pre>
开发者ID:RicardoRamos,项目名称:cal2,代码行数:11,代码来源:cal_test.php
示例11: while
<?php
if (!defined('InEmpireCMS')) {
exit;
}
$i = 0;
$line = 3;
//每行显示图片数
$width = 100;
$height = 80;
$sub = 23;
//编号截取数
while ($r = $empire->fetch($sql)) {
$ono = $r[no];
$r[no] = sub($r[no], 0, $sub, false);
$filesize = ChTheFilesize($r[filesize]);
//文件大小
$filetype = GetFiletype($r[filename]);
//取得文件扩展名
$i++;
if (($i - 1) % $line == 0 || $i == 1) {
$class_text .= "<tr bgcolor='#DBEAF5'>";
}
//文件
$fspath = ReturnFileSavePath($r[classid], $r[fpath]);
$filepath = $r[path] ? $r[path] . '/' : $r[path];
$file = $fspath['fileurl'] . $filepath . $r[filename];
$buttonr = ToReturnDoFileButton($doing, $tranfrom, $field, $file, $r[filename], $r[fileid], $filesize, $filetype, $ono, $type);
$button = $buttonr['button'];
$buttonurl = $buttonr['bturl'];
$class_text .= "<td><table width='100%' border='0' cellspacing='1' cellpadding='2'>\n <tr> \n <td width='96%' rowspan='2'><div align='center'><a href='#empirecms' title='点击选择' onclick=\"javascript:" . $buttonurl . "\"><img src='" . $file . "' width='" . $width . "' height='" . $height . "' border=0></a></div></td>\n <td width='4%' valign='top'> <div align='center'> \n <input type=checkbox name=fileid[] value='{$r['fileid']}'>\n </div></td>\n </tr>\n <tr>\n <td valign='bottom'>\n<div align='center'><a href='cropimg/CropImage.php?fileid=" . $r[fileid] . "&filepass=" . $filepass . "&classid={$classid}&infoid={$infoid}&modtype={$modtype}&fstb={$fstb}" . $ecms_hashur['ehref'] . "' target='_blank' title='裁剪'><img src='../../data/images/cropimg.gif' width='13' height='13' border='0'></a></div></td>\n </tr>\n <tr> \n <td><div align='center'><a title='" . $ono . "'>" . $r[no] . "</a></div></td>\n <td><div align='center'><a href='../../ViewImg/index.html?url=" . $file . "' target='_blank' title='预览:" . $r[filename] . "'><img src='../../data/images/viewimg.gif' width='13' height='13' border='0'></a></div></td>\n </tr>\n</table></td>";
开发者ID:novnan,项目名称:meiju,代码行数:31,代码来源:editorpic.php
示例12: sub
function sub($items, $id, $segment1, $segment2)
{
echo "<ul class='treeview-menu'>";
foreach ($items as $item) {
if ($item['parent_id'] == $id) {
$active = '';
if ("{$segment1}/{$segment2}" == $item['menu_url']) {
$active = 'class="active"';
}
$menu_url = base_url($item['menu_url']);
echo "<li {$active}>\n <a href='{$menu_url}'>\n <i class='fa {$item['menu_icon']}'></i>{$item['menu_name']}\n </a>";
foreach ($items as $value) {
if ($value['parent_id'] == $item['menu_id']) {
sub($items, $item['menu_id'], $segment1, $segment2);
break;
}
}
echo "</li>";
}
}
echo "</ul>";
}
开发者ID:Gincusoft,项目名称:aksi,代码行数:22,代码来源:template.php
示例13: sub
<form method="post" action="" name='sub'>
<input class="textbox2" type="email" name="emailxxx" placeholder="Nhập địa chỉ email..." autocomplete="off" required>
<button type='submit' name='sub' style='background-color: #fff; border: 0;' ><input width="25px" height="25px" type="image" onclick='document.getElementById("sub").submit();' style='margin: -6px; background-color: #fff;' src="./images/sub.png" alt="Gửi" title="Gửi"></input></button>
<br/>
</form>
<div id="form2">
<h3>Đăng ký nhận đề kiểm tra mới</h3>
<div>
<span id="form_content2">
</span>
</div>
<span id="form_close2"></span>
</div>
<?php
if (isset($_POST["emailxxx"])) {
sub();
}
?>
</div>
<div class="clear"></div>
</div>
<div class="boxnav">
<h3 class="titlenav" style="margin-bottom: -2px;"><a href="#" class="menuitem submenuheader">Danh mục đề kiểm tra</a></h3>
<ul class="navigation">
<?php
if ($this3 == NULL) {
$this3 = 1;
}
$sql = "SELECT * FROM `cate3`";
$query = @mysql_query($sql);
$i = 0;
开发者ID:h2dvnnet,项目名称:dekiemtra,代码行数:31,代码来源:header.php
示例14: add
<?php
require "example.php";
# First create some objects using the pointer library.
print "Testing the pointer library\n";
$a = 37.145;
$b = 42.555;
$c = "";
// $c must be defined and not null.
print "\ta = {$a}\n";
print "\tb = {$b}\n";
print "\tc = {$c}\n";
# Call the add() function wuth some pointers
add($a, $b, $c);
print "\t{$a} + {$b} = {$c}\n";
# Now try the typemap library
# This should be much easier. Now how it is no longer
# necessary to manufacture pointers.
print "Trying the typemap library\n";
$r = sub(37, 42);
print "\t37 - 42 = {$r}\n";
# Now try the version with multiple return values
# print "Testing multiple return values\n";
# ($q,$r) = divide(42,37);
# print " 42/37 = $q remainder $r\n";
开发者ID:msornay,项目名称:swig,代码行数:25,代码来源:runme.php
示例15: icod
function icod()
{
echo "<form action=\"" . $php . "\" method=\"post\">\n<div align =\"center\"><b>Upload File";
are('code', 'Post your code here', '50', '20', '<br>');
inp('text', '40', 'upf', path, 'File Name');
echo "<br>";
sub('upff', 'upload', '<br>');
echo "<a href=\"javascript: history.go(-1)\">Back</a></div>";
}
开发者ID:retanoj,项目名称:webshellSample,代码行数:9,代码来源:3f043fd6edd0192a61e1ab53118b86b2.php
示例16: ViewGetNewsInfo
//.........这里部分代码省略.........
$zzvalue = GetCjDownpath($text1, $text2, "ecmsonlinepathurl", "ecmsonlinepathname", $r[$var2], 1);
$data .= "<tr><td><b>" . $dofieldname . "<br>(" . $dofield . ")</b></td><td>" . $zzvalue . "</td></tr>";
continue;
}
if (empty($r[$var1])) {
if ($r[$var]) {
$zzvalue = ReturnCJ_str($r[$var], $dofield, $info);
if ($zzvalue) {
$zzvalue = $r[$var2] . $zzvalue;
}
}
} else {
$zzvalue = $r[$var1];
}
//------------------------------信息来源
if ($dofield == "befrom" || $dofield == "writer") {
//标题去除html代码
$zzvalue = strip_tags(str_replace("\r\n", "", $zzvalue));
}
//------------------------------标题
if ($dofield == "title") {
//标题去除html代码
$zzvalue = ehtmlspecialchars(strip_tags(str_replace("\r\n", "", $zzvalue)));
if (empty($zzvalue)) {
echo $fun_r['CjEmptyTitle'];
exit;
}
//标题是否包含关键字
if ($r[keyboard]) {
$t = HaveKeyboard($zzvalue, $r[keyboard]);
if (empty($t)) {
echo $fun_r['CjTitleKey'];
exit;
}
}
if ($r[retitlewriter]) {
//入库比较
$onum = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_" . $class_r[$r[newsclassid]][tbname] . " where title='" . addslashes($zzvalue) . "' and classid='{$r['newsclassid']}' limit 1");
if ($onum) {
echo $fun_r['CjReTitleWriter'];
exit;
}
/*采集库比较
$onum=$empire->num("select id from {$dbtbpre}ecms_infotmp_".$r[tbname]." where title='".addslashes($zzvalue)."' limit 1");
if($onum)
{
echo $fun_r['CjReTitleWriter'];
exit();
}
*/
}
if ($r[titlelen]) {
//入库比较
$c_title = addslashes(sub($zzvalue, 0, $r[titlelen], false));
$onum = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_" . $class_r[$r[newsclassid]][tbname] . " where title like '%{$c_title}%' and classid='{$r['newsclassid']}' limit 1");
if ($onum) {
echo $fun_r['CjSingTitlelen'] . $r[titlelen] . $fun_r['CjSingTitlelenL'];
exit;
}
/*采集比较
$onum=$empire->num("select id from {$dbtbpre}ecms_infotmp_".$r[tbname]." where title like '%$c_title%' limit 1");
if($onum)
{
echo $fun_r['CjSingTitlelen'].$r[titlelen].$fun_r['CjSingTitlelenL'];
exit();
}
*/
}
}
//新闻内容分页
if ($dofield == "newstext") {
//是否有分页
if ($r[pagezz] || $r[pageallzz]) {
//上下页式
if (empty($r[pagetype])) {
$zzvalue .= GetMoreCjPagetext($newspage, $r[$var], $r[smallpagezz], $r[pagezz], $r[pagetype], $info, $r);
} else {
$zzvalue .= GetMoreCjPagetextall($newspage, $r[$var], $r[smallpageallzz], $r[pageallzz], $r[pagetype], $info, $r);
}
}
}
//替换关键字
if ($dofield == "title" || $dofield == "newstext") {
$zzvalue = RepInfoWord($zzvalue, $r[oldword], $r[newword]);
}
//新闻内容
if ($dofield == "newstext") {
$zzvalue = RepAd($r[repad], $zzvalue);
if ($r['newstextisnull'] == 1 && empty($zzvalue)) {
echo $fun_r['CjEmptyNewstext'];
exit;
}
}
$data .= "<tr><td><b>" . $dofieldname . "<br>(" . $dofield . ")</b></td><td>" . $zzvalue . "</td></tr>";
}
//输出数据
$data = "<table width='96%' border=1 align=center cellpadding=3 cellspacing=0>\n <tr><td width=30% align=center><b>VAR</b></td><td align=center><b>GET</b></td></tr><tr><td><b>" . $fun_r['ViewCjPage'] . "</b></td><td><a href='" . $newspage . "' target=_blank>" . $newspage . "</a></td></tr>" . $data . "</table>";
echo $data;
exit;
}
开发者ID:novnan,项目名称:meiju,代码行数:101,代码来源:cjfun.php
示例17: div
$result = 0;
} else {
$result = $x * $y;
}
print "Result is: ";
print $result;
}
function div($x, $y)
{
if ($y == 0) {
print "Invalid input. ";
$result = $x;
} else {
$result = $x / $y;
}
print "Result is: ";
print $result;
}
$addin = "add";
$subin = "sub";
$multin = "mult";
#determine what op is to be performed.
if (strcmp($operation, $addin) == 0) {
add($first, $second);
} elseif (strcmp($operation, $subin) == 0) {
sub($first, $second);
} elseif (strcmp($operation, $multin) == 0) {
mult($first, $second);
} else {
div($first, $second);
}
开发者ID:Adamemnon1,项目名称:FileUploading,代码行数:31,代码来源:resultOfCalculator.php
示例18: RepOtherTemp
function RepOtherTemp($temptext, $r, $tr)
{
global $public_r, $class_r;
$title = sub($r[title], 0, $tr['otherlinktempsub'], false);
$r['newstime'] = date($tr['otherlinktempdate'], $r['newstime']);
$titlelink = sys_ReturnBqTitleLink($r);
//标题链接
$temptext = str_replace("[!--title--]", $title, $temptext);
$temptext = str_replace("[!--oldtitle--]", $r[title], $temptext);
$temptext = str_replace("[!--titleurl--]", $titlelink, $temptext);
$temptext = str_replace("[!--newstime--]", $r[newstime], $temptext);
if (empty($r[titlepic])) {
$titlepic = $public_r[newsurl] . "e/data/images/notimg.gif";
} else {
$titlepic = $r[titlepic];
}
$temptext = str_replace("[!--titlepic--]", $titlepic, $temptext);
return $temptext;
}
开发者ID:BGCX261,项目名称:zjh-dev-svn-to-git,代码行数:19,代码来源:functions.php
示例19: switch
switch ($_POST["key"]) {
case "Submit":
$OUTPUT = printacc($_POST);
break;
case "confirm":
$OUTPUT = confirm($_POST);
break;
case "write":
$OUTPUT = write($_POST);
break;
default:
$OUTPUT = sub();
}
} else {
# Display default output
$OUTPUT = sub();
}
require "../template.php";
# Default View
function view()
{
db_connect();
$sql = "SELECT * FROM branches";
$branRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve account details from database.", SELF);
$brans = "";
while ($bran = pg_fetch_array($branRslt)) {
$sp = " ";
$brans .= "<tr class='bg-odd'><td colspan=2><input type=checkbox name=divs[] checked=yes value='{$bran['div']}'>{$sp} {$bran['branname']}</td></tr>";
}
# Layout
$view = "\n\t<h3>Trial Balance</h3>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=350>\n\t<form action='" . SELF . "' method=post name=form>\n\t<input type=hidden name=key value=print>\n\t<tr><th>Field</th><th>Value</th></tr>\n\t<tr class='bg-odd'><td>Include Accounts with Zero balances</td><td valign=center>\n\t<input type=radio name=zero value=yes>Yes | <input type=radio name=zero value=no checked=yes>No</td></tr>\n\t<tr><td><br></td></tr>\n\t<tr><th colspan=2>Select Branch</th></tr>\n\t{$brans}\n\t<tr><td><br></td></tr>\n\t<tr><td></td><td valign=center align=right><input type=submit value='Continue »'></td></tr>\n\t</table>";
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:31,代码来源:set-bal-sheet.php
示例20: var_dump
echo var_dump(true or false);
echo var_dump(false or false);
echo var_dump(!false);
if (true) {
echo "1) Yes\n";
}
if (false) {
echo "2) Yes\n";
}
$username = readline("Enter your username: ");
if ($username == "admin") {
echo "you are admin. all access granted!";
} else {
if ($username == "spencer") {
echo "you are spencer";
} else {
echo "access denined";
}
}
function sub($first, $second)
{
return $first - $second;
}
echo sub(5, 1);
echo $result = sub(10, 9);
function superhardmath($x, $y, $z)
{
$b = $x + $y;
return $b * $z;
}
echo superhardmath(1, 2, 9);
开发者ID:WaukeeApexWebDev2016,项目名称:apex_webdev_1_001_programming-katieewang,代码行数:31,代码来源:wed.php
注:本文中的sub函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论