本文整理汇总了PHP中sizeof函数的典型用法代码示例。如果您正苦于以下问题:PHP sizeof函数的具体用法?PHP sizeof怎么用?PHP sizeof使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sizeof函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unmarshalFrom
/**
* Unmarshal return value from a specified node
*
* @param xml.Node node
* @return webservices.uddi.BusinessList
* @see xp://webservices.uddi.UDDICommand#unmarshalFrom
* @throws lang.FormatException in case of an unexpected response
*/
public function unmarshalFrom($node)
{
if (0 != strcasecmp($node->name, 'businessList')) {
throw new \lang\FormatException('Expected "businessList", got "' . $node->name . '"');
}
// Create business list object from XML representation
with($list = new BusinessList(), $children = $node->nodeAt(0)->getChildren());
$list->setOperator($node->getAttribute('operator'));
$list->setTruncated(0 == strcasecmp('true', $node->getAttribute('truncated')));
for ($i = 0, $s = sizeof($children); $i < $s; $i++) {
$b = new Business($children[$i]->getAttribute('businessKey'));
for ($j = 0, $t = sizeof($children[$i]->getChildren()); $j < $s; $j++) {
switch ($children[$i]->nodeAt($j)->name) {
case 'name':
$b->names[] = $children[$i]->nodeAt($j)->getContent();
break;
case 'description':
$b->description = $children[$i]->nodeAt($j)->getContent();
break;
}
}
$list->items[] = $b;
}
return $list;
}
示例2: _buildCategoryTree
/** Function builds one dimentional category tree based on given array
*
* @param array $all_categories
* @param int $parent_id
* @param string $path
* @return array
*/
private function _buildCategoryTree($all_categories = array(), $parent_id = 0, $path = '')
{
$output = array();
foreach ($all_categories as $category) {
if ($parent_id != $category['parent_id']) {
continue;
}
$category['path'] = $path ? $path . '_' . $category['category_id'] : $category['category_id'];
$category['parents'] = explode("_", $category['path']);
$category['level'] = sizeof($category['parents']) - 1;
//digin' level
if ($category['category_id'] == $this->category_id) {
//mark root
$this->selected_root_id = $category['parents'][0];
}
$output[] = $category;
$output = array_merge($output, $this->_buildCategoryTree($all_categories, $category['category_id'], $category['path']));
}
if ($parent_id == 0) {
$this->data['all_categories'] = $output;
//place result into memory for future usage (for menu. see below)
// cut list and expand only selected tree branch
$cutted_tree = array();
foreach ($output as $category) {
if ($category['parent_id'] != 0 && !in_array($this->selected_root_id, $category['parents'])) {
continue;
}
$category['href'] = $this->html->getSEOURL('product/category', '&path=' . $category['path'], '&encode');
$cutted_tree[] = $category;
}
return $cutted_tree;
} else {
return $output;
}
}
示例3: listCommands
private static function listCommands()
{
$commands = array();
$dir = __DIR__;
if ($handle = opendir($dir)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != ".." && $entry != "base.php") {
$s1 = explode("cli_", $entry);
$s2 = explode(".php", $s1[1]);
if (sizeof($s2) == 2) {
require_once "{$dir}/{$entry}";
$command = $s2[0];
$className = "cli_{$command}";
$class = new $className();
if (is_a($class, "cliCommand")) {
$commands[] = $command;
}
}
}
}
closedir($handle);
}
sort($commands);
return implode(" ", $commands);
}
示例4: clsRecordchange_passwordchangepwd1
function clsRecordchange_passwordchangepwd1($RelativePath, &$Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->Visible = true;
$this->Parent =& $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record changepwd1/Error";
$this->DataSource = new clschange_passwordchangepwd1DataSource($this);
$this->ds =& $this->DataSource;
$this->UpdateAllowed = true;
$this->ReadAllowed = true;
if ($this->Visible) {
$this->ComponentName = "changepwd1";
$this->Attributes = new clsAttributes($this->ComponentName . ":");
$CCSForm = explode(":", CCGetFromGet("ccsForm", ""), 2);
if (sizeof($CCSForm) == 1) {
$CCSForm[1] = "";
}
list($FormName, $FormMethod) = $CCSForm;
$this->EditMode = $FormMethod == "Edit";
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = $FormName == $this->ComponentName;
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->oldpwd = new clsControl(ccsTextBox, "oldpwd", "Old Password", ccsText, "", CCGetRequestParam("oldpwd", $Method, NULL), $this);
$this->oldpwd->Required = true;
$this->newpwd = new clsControl(ccsTextBox, "newpwd", "New Password", ccsText, "", CCGetRequestParam("newpwd", $Method, NULL), $this);
$this->newpwd->Required = true;
$this->confirmpwd = new clsControl(ccsTextBox, "confirmpwd", "Confirm Password", ccsText, "", CCGetRequestParam("confirmpwd", $Method, NULL), $this);
$this->confirmpwd->Required = true;
$this->Button1 = new clsButton("Button1", $Method, $this);
}
}
示例5: clsRecordt_rep_bphtb_registrationSearch
function clsRecordt_rep_bphtb_registrationSearch($RelativePath, &$Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->Visible = true;
$this->Parent =& $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record t_rep_bphtb_registrationSearch/Error";
$this->ReadAllowed = true;
if ($this->Visible) {
$this->ComponentName = "t_rep_bphtb_registrationSearch";
$this->Attributes = new clsAttributes($this->ComponentName . ":");
$CCSForm = explode(":", CCGetFromGet("ccsForm", ""), 2);
if (sizeof($CCSForm) == 1) {
$CCSForm[1] = "";
}
list($FormName, $FormMethod) = $CCSForm;
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = $FormName == $this->ComponentName;
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->wp_name =& new clsControl(ccsTextBox, "wp_name", "wp_name", ccsDate, array("dd", "-", "mm", "-", "yyyy"), CCGetRequestParam("wp_name", $Method, NULL), $this);
$this->Button_DoSearch =& new clsButton("Button_DoSearch", $Method, $this);
$this->t_bphtb_registration_id =& new clsControl(ccsHidden, "t_bphtb_registration_id", "t_bphtb_registration_id", ccsText, "", CCGetRequestParam("t_bphtb_registration_id", $Method, NULL), $this);
}
}
示例6: prepare_form
/**
* {@inheritdoc}
*/
public function prepare_form($request, $template, $user, $row, &$error)
{
$avatar_list = $this->get_avatar_list($user);
$category = $request->variable('avatar_local_cat', key($avatar_list));
foreach ($avatar_list as $cat => $null) {
if (!empty($avatar_list[$cat])) {
$template->assign_block_vars('avatar_local_cats', array('NAME' => $cat, 'SELECTED' => $cat == $category));
}
if ($cat != $category) {
unset($avatar_list[$cat]);
}
}
if (!empty($avatar_list[$category])) {
$template->assign_vars(array('AVATAR_LOCAL_SHOW' => true));
$table_cols = isset($row['avatar_gallery_cols']) ? $row['avatar_gallery_cols'] : 4;
$row_count = $col_count = $avatar_pos = 0;
$avatar_count = sizeof($avatar_list[$category]);
reset($avatar_list[$category]);
while ($avatar_pos < $avatar_count) {
$img = current($avatar_list[$category]);
next($avatar_list[$category]);
if ($col_count == 0) {
++$row_count;
$template->assign_block_vars('avatar_local_row', array());
}
$template->assign_block_vars('avatar_local_row.avatar_local_col', array('AVATAR_IMAGE' => $this->phpbb_root_path . $this->config['avatar_gallery_path'] . '/' . $img['file'], 'AVATAR_NAME' => $img['name'], 'AVATAR_FILE' => $img['filename'], 'CHECKED' => $img['file'] === $row['avatar']));
$template->assign_block_vars('avatar_local_row.avatar_local_option', array('AVATAR_FILE' => $img['filename'], 'S_OPTIONS_AVATAR' => $img['filename'], 'CHECKED' => $img['file'] === $row['avatar']));
$col_count = ($col_count + 1) % $table_cols;
++$avatar_pos;
}
}
return true;
}
示例7: createFromArray
public static function createFromArray($a = array())
{
if (sizeof($a) === 0) {
throw new FoursquareException('not an array');
}
return new FoursquarePhoto($a);
}
示例8: run
function run()
{
add_action('w3tc_dashboard_setup', array(&$this, 'wp_dashboard_setup'));
add_action('w3tc_network_dashboard_setup', array(&$this, 'wp_dashboard_setup'));
// Configure authorize and have_zone
$this->_setup($this->_config);
/**
* Retry setup with main blog
*/
if (w3_is_network() && is_network_admin() && !$this->authorized) {
$this->_config = new W3_Config(false, 1);
$this->_setup($this->_config);
}
if (w3_is_network()) {
$conig_admin = w3_instance('W3_ConfigAdmin');
$this->_sealed = $conig_admin->get_boolean('cdn.configuration_sealed');
}
if ($this->have_zone && $this->authorized && isset($_GET['page']) && strpos($_GET['page'], 'w3tc_dashboard') !== false) {
w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNA.php');
w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNAPresentation.php');
$authorization_key = $this->_config->get_string('cdn.maxcdn.authorization_key');
$alias = $consumerkey = $consumersecret = '';
$keys = explode('+', $authorization_key);
if (sizeof($keys) == 3) {
list($alias, $consumerkey, $consumersecret) = $keys;
}
$this->api = new NetDNA($alias, $consumerkey, $consumersecret);
add_action('admin_head', array(&$this, 'admin_head'));
}
}
示例9: parseData
/**
* aangepaste parseData functie die overweg kan met 1 rij ipv een array met daarin een array
*
* @param unknown_type $data
* @return unknown
*/
function parseData($data)
{
$result = array();
$result['gebruikersnaam'] = $data["uid"][0];
$result['voornaam'] = $data["ugentpreferredgivenname"][0];
$result['achternaam'] = $data["ugentpreferredsn"][0];
$result['email'] = $data["mail"][0];
$kot = $data["ugentdormpostaladdress"][0];
if ($kot != "") {
$kot = explode("\$", $kot);
if (strpos(" " . $kot[0], "HOME")) {
//VUILE LDAP HACK :(
$kot[0] = $kot[0] == "HOME BERTHA DE VRIES" ? "HOME BERTHA DE VRIESE" : $kot[0];
$home = Home::getHome("ldapNaam", $kot[0]);
$result['homeId'] = $home->getId();
$result['home'] = $home->getLangeNaam();
$temp = explode(":", $kot[1]);
if (sizeof($temp) > 1) {
$result['kamer'] = $temp[1];
} else {
$temp = explode("(", $kot[1]);
$temp = explode(")", $temp[1]);
if (sizeof($temp) > 1) {
$result['kamer'] = $home->getKamerPrefix() . "." . $temp[0];
} else {
$temp = explode("K. ", $kot[1]);
$result['kamer'] = $home->getKamerPrefix() . "." . converteer($temp[0]);
//er wordt nog een oud kamernummer gebruikt
}
}
}
}
return $result;
}
示例10: convertToCurrency
function convertToCurrency($uang)
{
$number = (string) $uang;
$numberLength = strlen($number);
$numberArray = array();
$currencyArray = array();
$currency = "";
for ($i = 0; $i < $numberLength; $i++) {
array_push($numberArray, $number[$i]);
}
$j = $numberLength - 1;
$k = $numberLength - 1;
for ($i = 0; $i <= $j; $i++) {
$currencyArray[$i] = $numberArray[$k];
$k--;
}
$count = 0;
for ($i = 0; $i < sizeof($currencyArray); $i++) {
if ($count % 3 == 0 && $count != 0) {
$currency = $currency . ".";
}
$currency = $currency . $currencyArray[$i];
$count++;
}
return strrev($currency);
}
示例11: listbox
function listbox($name, $data, $selected_value, $attributes = null)
{
$_attributes = array('value_key' => 'id', 'label_key' => 'name');
if ($attributes) {
if (array_key_exists('value_key', $attributes)) {
$_attributes['value_key'] = $attributes['value_key'];
}
if (array_key_exists('label_key', $attributes)) {
$_attributes['label_key'] = $attributes['label_key'];
}
}
$valueKey = $_attributes['value_key'];
$labelKey = $_attributes['label_key'];
$open_select = sprintf('<select name="%s" id="list_%s">', $name, $name);
$select_data = "";
if ($data && sizeof($data) > 0) {
$select_data .= sprintf('<option value="">--</option>');
foreach ($data as $item) {
if ($item->{$valueKey} == $selected_value) {
$select_data .= sprintf('<option value="%s" selected>%s</option>', $item->{$valueKey}, $item->{$labelKey});
} else {
$select_data .= sprintf('<option value="%s">%s</option>', $item->{$valueKey}, $item->{$labelKey});
}
}
}
$close_select = '</select>';
return $open_select . $select_data . $close_select;
}
示例12: calculate_shipping
public function calculate_shipping()
{
/** @var \jigoshop_tax $_tax */
$_tax = $this->get_tax();
$this->shipping_total = 0;
$this->shipping_tax = 0;
if ($this->type == 'order') {
// Shipping for whole order
$this->shipping_total = $this->cost + $this->get_fee($this->fee, jigoshop_cart::$cart_contents_total);
$this->shipping_total = $this->shipping_total < 0 ? 0 : $this->shipping_total;
// fix flat rate taxes for now. This is old and deprecated, but need to think about how to utilize the total_shipping_tax_amount yet
if (Jigoshop_Base::get_options()->get('jigoshop_calc_taxes') == 'yes' && $this->tax_status == 'taxable') {
$this->shipping_tax = $this->calculate_shipping_tax($this->shipping_total);
}
} else {
// Shipping per item
if (sizeof(jigoshop_cart::$cart_contents) > 0) {
foreach (jigoshop_cart::$cart_contents as $item_id => $values) {
/** @var jigoshop_product $_product */
$_product = $values['data'];
if ($_product->exists() && $values['quantity'] > 0 && !$_product->is_type('downloadable')) {
$item_shipping_price = ($this->cost + $this->get_fee($this->fee, $_product->get_price())) * $values['quantity'];
$this->shipping_total = $this->shipping_total + $item_shipping_price;
//TODO: need to figure out how to handle per item shipping with discounts that apply to shipping as well
// * currently not working. Will need to fix
if ($_product->is_shipping_taxable() && $this->tax_status == 'taxable') {
$_tax->calculate_shipping_tax($item_shipping_price, $this->id, $_product->get_tax_classes());
}
}
}
$this->shipping_tax = $_tax->get_total_shipping_tax_amount();
}
}
}
示例13: ajoutLieu
function ajoutLieu()
{
require 'connect.php';
$requete = $bdd->query("SELECT \n\t\t\t\t\t\t\t\tVILID\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\tcommune");
$villes = $requete->fetchAll();
$requete->closeCursor();
$requete = $bdd->prepare("SELECT \n\t\t\t\t\t\t\t\tLIEUID\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\tLIEU\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tLIEUID=:lieuId\n\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\tVILID=:ville\n\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\tLIEUNOM=:nom");
$requeteSeconde = $bdd->prepare("INSERT INTO LIEU\n\t\t\t\t\t\t\t\t\t\t(LIEUID,\n\t\t\t\t\t\t\t\t\t\tVILID,\n\t\t\t\t\t\t\t\t\t\tLIEUNOM,\n\t\t\t\t\t\t\t\t\t\tLIEUCOORDGPS)\n\t\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t\t(:lieuId,\n\t\t\t\t\t\t\t\t\t\t:ville,\n\t\t\t\t\t\t\t\t\t\t:nom,\n\t\t\t\t\t\t\t\t\t\t:gps)");
for ($i = 0; $i < 100; $i++) {
echo $lieuId = $i;
echo $ville = $villes[rand(0, sizeof($villes) - 1)]['VILID'];
$lieuT = file('./generateurLieu.txt');
$lieu = array(trim($lieuT[rand(0, 93)]), trim($lieuT[rand(0, 93)]));
$lieu = implode("-", $lieu);
echo $nom = $lieu;
echo $gps = rand(0, 5000);
echo "<br />";
$requete->execute(array("ville" => $ville, "nom" => $nom));
if ($requete->fetch() == false) {
$requeteSeconde->execute(array("lieuId" => $lieuId, "ville" => $ville, "nom" => $nom, "gps" => $gps));
} else {
$i--;
}
}
$requete->closeCursor();
$requeteSeconde->closeCursor();
}
示例14: getTablaUsuarios
public function getTablaUsuarios()
{
//get de los usuarioes
$usuarios = $this->UsuariosDAO->getUsuarios();
//valida si hay usuarioes
if ($usuarios) {
for ($a = 0; $a < sizeof($usuarios); $a++) {
$id = $usuarios[$a]["pkID"];
$alias = $usuarios[$a]["alias"];
$nombres = $usuarios[$a]["nombres"];
$apellidos = $usuarios[$a]["apellidos"];
$numero_cc = $usuarios[$a]["numero_cc"];
$nom_tipo = $usuarios[$a]["nom_tipo"];
echo '
<tr>
<td>' . $id . '</td>
<td>' . $alias . '</td>
<td>' . $nombres . '</td>
<td>' . $apellidos . '</td>
<td>' . $numero_cc . '</td>
<td>' . $nom_tipo . '</td>
<td>
<button id="btn_editar" name="edita_usuario" type="button" class="btn btn-primary" data-toggle="modal" data-target="#frm_modal_usuario" data-id-usuario = "' . $id . '" ><span class="glyphicon glyphicon-pencil"></span> Editar</button>
<br><br>
<button id="btn_eliminar" name="elimina_usuario" type="button" class="btn btn-danger" data-id-usuario = "' . $id . '" ><span class="glyphicon glyphicon-remove"></span> Eliminar</button>
</td>
</tr>';
}
} else {
echo "<tr>\n\t <td></td>\n\t <td></td>\n\t <td></td>\t\t \t\t \n\t </tr>\n\t <h3>En este momento no hay usuarioes creadas.</h3>";
}
}
示例15: wsOnMessage
function wsOnMessage($clientID, $message, $messageLength, $binary)
{
global $Server;
$ip = long2ip($Server->wsClients[$clientID][6]);
// check if message length is 0
if ($messageLength == 0) {
$Server->wsClose($clientID);
return;
}
//The speaker is the only person in the room. Don't let them feel lonely.
if (sizeof($Server->wsClients) == 1) {
$Server->wsSend($clientID, "There isn't anyone else in the room, but I'll still listen to you. --Your Trusty Server");
} else {
//Send the message to everyone but the person who said it
foreach ($Server->wsClients as $id => $client) {
if ($id != $clientID) {
$Server->wsSend($id, "{$message}");
}
}
}
//and to arduino forst decoding mesage and sending only one byte
if ("{$message}" == "arduino1") {
`mode com4: BAUD=9600 PARITY=N data=8 stop=1 xon=off`;
$fp = fopen("com4", "w+");
fwrite($fp, chr(0x1));
fclose($fp);
}
}