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


PHP SplDoublyLinkedList::count方法代码示例

本文整理汇总了PHP中SplDoublyLinkedList::count方法的典型用法代码示例。如果您正苦于以下问题:PHP SplDoublyLinkedList::count方法的具体用法?PHP SplDoublyLinkedList::count怎么用?PHP SplDoublyLinkedList::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SplDoublyLinkedList的用法示例。


在下文中一共展示了SplDoublyLinkedList::count方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: hasListeners

 /**
  * Returns true, if the item has any listeners.
  *
  * @return Boolean
  */
 public function hasListeners()
 {
     if ($this->_listeners === null) {
         return false;
     }
     return $this->_listeners->count() > 0;
 }
开发者ID:OPL,项目名称:Open-Power-Forms,代码行数:12,代码来源:Item.php

示例2: count

 /**
  * Returns the number or items in this collection
  *
  * @return int
  */
 public function count()
 {
     if (!$this->_started) {
         $this->rewind();
     }
     while ($this->valid()) {
         $this->next();
     }
     return $this->_buffer->count();
 }
开发者ID:rlugojr,项目名称:cakephp,代码行数:15,代码来源:BufferedIterator.php

示例3:

// push($value)
// 在结尾插入一个新值
$list->push('value1');
$list->push('value2');
$list->push('value3');
$list->push('value4');
$list->push('value5');
// pop()
// 抛出结尾的一个元素,会使得链表结构减少一个
$list->pop();
// key()
// 获得当前节点的索引值
$list->key();
// count()
// 获得链表的数量
$list->count();
// rewind()
// 将指针返回至初始节点
$list->rewind();
// current()
// 获得当前节点
$list->current();
// top()
// 返回最后一个节点的值
$list->top();
// bottom()
// 返回第一个节点的值
$list->bottom();
// next()
// 指针移到下一个节点
$list->next();
开发者ID:ray0916,项目名称:learn,代码行数:31,代码来源:splDoublyLinkedList.php

示例4: SplDoublyLinkedList

<?php

$dll = new SplDoublyLinkedList(2);
$dll->count(new SplDoublyLinkedList(2));
开发者ID:badlamer,项目名称:hhvm,代码行数:4,代码来源:SplDoublyLinkedList_count_param_SplDoublyLinkedList.php

示例5:

    ?>
">
                                                <i class="glyphicon glyphicon-shopping-cart icon-white"></i>
                                                Enviar al Carrito
                                            </a>
                                        </td>
                                    </tr>
                                    <?php 
}
?>


                            </tbody>
                        </table>
                        <?php 
if ($listPila->count() == 0) {
    ?>
                                <p>No se encuentran productos, por favor regrese e intente seleccionar otro producto.</p>
                                <a class="btn btn-default btn-lg" href="products.php?pas=<?php 
    echo $_GET['pas'];
    ?>
&type=<?php 
    echo $_GET['type'];
    ?>
&select=1">
                                    <i class="glyphicon glyphicon-chevron-left"></i>
                                    Seleccionar otro producto
                                </a>
                            <?php 
}
?>
开发者ID:asandi01,项目名称:phpLitsTest,代码行数:31,代码来源:product.php

示例6: unset

    echo "Mem real: " . __convert(memory_get_usage(true)) . "\n";
    unset($array);
    echo "\n-- SplDoublyLinkedList \n";
    echo "Mem usage: " . __convert(memory_get_usage()) . "\n";
    echo "Mem real: " . __convert(memory_get_usage(true)) . "\n";
    $s = microtime(true);
    $spl = new SplDoublyLinkedList();
    for ($i = 0; $i < $v; $i++) {
        $spl->push($i);
    }
    try {
        $spl->offsetUnset(102);
        var_dump($spl->offsetGet(100));
        var_dump($spl->offsetGet(102));
    } catch (OutOfRangeException $e) {
        echo $e;
    }
    $e = microtime(true);
    echo "Count: " . $spl->count() . "\n";
    echo "Elapsed time: " . ($e - $s) . " sec.\n";
    echo "Mem usage: " . __convert(memory_get_usage()) . "\n";
    echo "Mem real: " . __convert(memory_get_usage(true)) . "\n";
    try {
        for ($i = 0; $i < $v; $i++) {
            $spl->pop();
        }
    } catch (Exception $e) {
    }
    unset($spl);
    echo "\n";
}
开发者ID:balajivenki,项目名称:php-judy,代码行数:31,代码来源:judy-bench-bitset.php

示例7: SplDoublyLinkedList

<?php

$dll = new SplDoublyLinkedList();
$dll->push(2);
$dll->push(3);
$dll->push(4);
$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
foreach ($dll as $k => $v) {
    echo "{$k}=>{$v}\n";
}
$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
foreach ($dll as $k => $v) {
    echo "{$k}=>{$v}\n";
}
$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_DELETE);
var_dump($dll->count());
foreach ($dll as $k => $v) {
    echo "{$k}=>{$v}\n";
}
var_dump($dll->count());
?>
===DONE===
开发者ID:gleamingthecube,项目名称:php,代码行数:22,代码来源:ext_spl_tests_dllist_003.php

示例8: count

 public function count()
 {
     return -parent::count();
 }
开发者ID:badlamer,项目名称:hhvm,代码行数:4,代码来源:dllist_008.php

示例9: count

 /**
  * (PHP 5 >= 5.1.0)
  * Count elements of an object
  *
  * @link http://php.net/manual/en/countable.count.php
  * @return integer The custom count as an integer.
  */
 public function count()
 {
     return $this->storage->count();
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:11,代码来源:AbstractRecordCollection.php

示例10: SplDoublyLinkedList

<?php

$list = new SplDoublyLinkedList();
$c = $list->count('foo');
开发者ID:badlamer,项目名称:hhvm,代码行数:4,代码来源:SplDoublyLinkedList_count.php

示例11: SplDoublyLinkedList

<?php

$ll = new SplDoublyLinkedList();
$ll->push('1');
$ll->push('2');
$ll->push('3');
try {
    $ll->offsetUnset($ll->count() + 1);
    var_dump($ll);
} catch (Exception $e) {
    echo $e->getMessage();
}
开发者ID:badlamer,项目名称:hhvm,代码行数:12,代码来源:SplDoublyLinkedList_offsetUnset_greater_than_elements.php

示例12: solve

 private function solve($formula)
 {
     $findSubFormula = false;
     $stringStart = 0;
     $stringLength = 0;
     $stack = new \SplStack();
     $subFormulas = [];
     for ($i = 0; $i < strlen($formula); $i++) {
         $char = $formula[$i];
         if ($this->isBracketOpen($char)) {
             if ($findSubFormula == false && $stack->count() == 0) {
                 $stringStart = $i;
             }
             $stack->push(1);
             $findSubFormula = true;
         }
         if ($findSubFormula) {
             $stringLength++;
         }
         if ($this->isBracketClose($char)) {
             $stack->pop();
             if ($stack->count() === 0 && $findSubFormula) {
                 $subFormulas[substr($formula, $stringStart, $stringLength)] = substr($formula, $stringStart, $stringLength);
                 $findSubFormula = false;
                 $stringLength = 0;
             }
         }
     }
     if (count($subFormulas) > 0) {
         foreach ($subFormulas as &$subFormula) {
             $temp = trim(substr($subFormula, 1, strlen($subFormula) - 2));
             $subFormula = $this->solve($temp);
         }
         $formula = str_replace(array_keys($subFormulas), array_values($subFormulas), $formula);
     }
     $elems = new \SplDoublyLinkedList();
     array_map(function ($item) use($elems) {
         if ($item != ' ') {
             $elems->push($item);
         }
     }, explode(' ', $formula));
     while ($elems->count() > 1) {
         $maxPriority = 0;
         $index = 0;
         foreach ($elems as $i => $el) {
             if (isset(static::$symbols[$el]) && static::$symbols[$el] > $maxPriority) {
                 $maxPriority = static::$symbols[$el];
                 $index = $i;
             }
         }
         $this->process($index, $elems);
     }
     return $elems->pop();
 }
开发者ID:ygto,项目名称:calculator,代码行数:54,代码来源:Calculator.php

示例13: SplDoublyLinkedList

<?php

$dll = new SplDoublyLinkedList();
$dll->push('Never');
$dll->push('gonna');
$dll->push('give');
// at pos 0, shift everything up
$dll->add(0, 'you');
// Should be the end
$dll->add(4, 'up');
// Somewhere in the middle
$dll->add(2, 'let');
try {
    // Key 12 is unaccessible
    $dll->add(12, 'down');
} catch (OutOfRangeException $e) {
    echo $e->getMessage(), PHP_EOL;
}
foreach ($dll as $key => $val) {
    echo $key . '=>' . $val, PHP_EOL;
}
echo "count(): " . $dll->count(), PHP_EOL;
echo "top(): " . $dll->top(), PHP_EOL;
echo "bottom(): " . $dll->bottom(), PHP_EOL;
开发者ID:badlamer,项目名称:hhvm,代码行数:24,代码来源:SplDoublyLinkedList_add.php

示例14: count

 /**
  * Counts the number of tokens in the list.
  *
  * @return int Returns the number of tokens in the list.
  * @link http://www.php.net/manual/en/spldoublylinkedlist.count.php
  */
 public function count()
 {
     return $this->tokens->count();
 }
开发者ID:mohiva,项目名称:common,代码行数:10,代码来源:TokenStream.php


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