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


PHP box函数代码示例

本文整理汇总了PHP中box函数的典型用法代码示例。如果您正苦于以下问题:PHP box函数的具体用法?PHP box怎么用?PHP box使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test

 /**
  * Search tree test program.
  *
  * @param object ISearchTree $tree The tree to test.
  */
 public static function test(ISearchTree $tree)
 {
     printf("AbstractSearchTree test program.\n");
     printf("%s\n", str($tree));
     for ($i = 1; $i <= 8; ++$i) {
         $tree->insert(box($i));
     }
     printf("%s\n", str($tree));
     printf("Breadth-First traversal\n");
     $tree->breadthFirstTraversal(new PrintingVisitor(STDOUT));
     printf("Preorder traversal\n");
     $tree->depthFirstTraversal(new PreOrder(new PrintingVisitor(STDOUT)));
     printf("Inorder traversal\n");
     $tree->depthFirstTraversal(new InOrder(new PrintingVisitor(STDOUT)));
     printf("Postorder traversal\n");
     $tree->depthFirstTraversal(new PostOrder(new PrintingVisitor(STDOUT)));
     printf("Using foreach\n");
     foreach ($tree as $obj) {
         printf("%s\n", str($obj));
     }
     printf("Using reduce\n");
     $tree->reduce(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), '');
     printf("Using accept\n");
     $tree->accept(new ReducingVisitor(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), ''));
     printf("Withdrawing 4\n");
     $obj = $tree->find(box(4));
     try {
         $tree->withdraw($obj);
         printf("%s\n", str($tree));
     } catch (Exception $e) {
         printf("Caught %s\n", $e->getMessage());
     }
 }
开发者ID:EdenChan,项目名称:Instances,代码行数:38,代码来源:AbstractSearchTree.php

示例2: test

 /**
  * PriorityQueue test method.
  *
  * @param object IPriorityQueue $pqueue The queue to test.
  */
 public static function test(IPriorityQueue $pqueue)
 {
     printf("AbstractPriorityQueue test program.\n");
     printf("%s\n", str($pqueue));
     $pqueue->enqueue(box(3));
     $pqueue->enqueue(box(1));
     $pqueue->enqueue(box(4));
     $pqueue->enqueue(box(1));
     $pqueue->enqueue(box(5));
     $pqueue->enqueue(box(9));
     $pqueue->enqueue(box(2));
     $pqueue->enqueue(box(6));
     $pqueue->enqueue(box(5));
     $pqueue->enqueue(box(4));
     printf("%s\n", str($pqueue));
     printf("Using reduce\n");
     $pqueue->reduce(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), '');
     printf("Using foreach\n");
     foreach ($pqueue as $obj) {
         printf("%s\n", str($obj));
     }
     printf("Dequeueing\n");
     while (!$pqueue->isEmpty()) {
         $obj = $pqueue->dequeueMin();
         printf("%s\n", str($obj));
     }
 }
开发者ID:EdenChan,项目名称:Instances,代码行数:32,代码来源:AbstractPriorityQueue.php

示例3: test

 /**
  * Stack test method.
  *
  * @param object IStack $stack The stack to test.
  */
 public static function test(IStack $stack)
 {
     printf("AbstractStack test program.\n");
     for ($i = 0; $i < 6; ++$i) {
         if ($stack->isFull()) {
             break;
         }
         $stack->push(box($i));
     }
     printf("%s\n", str($stack));
     printf("Using foreach\n");
     foreach ($stack as $obj) {
         printf("%s\n", str($obj));
     }
     printf("Using reduce\n");
     $stack->reduce(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), '');
     printf("Top is %s\n", str($stack->getTop()));
     printf("Popping\n");
     while (!$stack->isEmpty()) {
         $obj = $stack->pop();
         printf("%s\n", str($obj));
     }
     $stack->push(box(2));
     $stack->push(box(4));
     $stack->push(box(6));
     printf("%s\n", str($stack));
     printf("Purging\n");
     $stack->purge();
     printf("%s\n", str($stack));
 }
开发者ID:EdenChan,项目名称:Instances,代码行数:35,代码来源:AbstractStack.php

示例4: test

 /**
  * OrderedList test method.
  *
  * @param object IOrderedList $list The list to test.
  */
 public static function test(IOrderedList $list)
 {
     printf("AbstractOrderedList test program.\n");
     $list->insert(box(1));
     $list->insert(box(2));
     $list->insert(box(3));
     $list->insert(box(4));
     printf("%s\n", str($list));
     $obj = $list->find(box(2));
     $list->withdraw($obj);
     printf("%s\n", str($list));
     $position = $list->findPosition(box(3));
     $position->insertAfter(box(5));
     printf("%s\n", str($list));
     $position->insertBefore(box(6));
     printf("%s\n", str($list));
     $position->withdraw();
     printf("%s\n", str($list));
     printf("Using foreach\n");
     foreach ($list as $obj) {
         printf("%s\n", str($obj));
     }
     printf("Using reduce\n");
     $list->reduce(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), '');
 }
开发者ID:EdenChan,项目名称:Instances,代码行数:30,代码来源:AbstractOrderedList.php

示例5: rhcontent

function rhcontent()
{
    date_default_timezone_set("Europe/London");
    $stuff = "Submitted " . date('l dS \\of F Y h:i:s A') . "\n";
    ob_start();
    print_r($_POST);
    $stuff .= ob_get_contents();
    ob_end_clean();
    $ouremail = "steven@swaledalesqueeze.org.uk";
    mail($ouremail, "Swaledale booking", $stuff, "From: {$ouremail}");
    extract($_POST);
    $balance = $cost - 25;
    $message = <<<EOT
_Thanks for your booking request._

We can confirm your place on the Swaledale Squeeze once we have received your deposit of £25 payable to Swaledale Squeeze at: 

    Steven Bradley
    Annfield House
    Front Street
    Langley Park
    Durham
    DH7 9XE

If you wish you can pay the full amount of £{$cost} now or pay the deposit now and the balance of £{$balance} by 1st May 2016.

Once I receive your deposit I'll let you know.

Thanks from Steven
EOT;
    box(Markdown($message));
    mail($_POST['email'], "Swaledale Squeeze: thanks for booking", $message, "From: {$ouremail}");
    box("We've also sent these instructions to your email address. Thanks again.");
}
开发者ID:stevenaeola,项目名称:swaledalesqueeze,代码行数:34,代码来源:bookingthanks.php

示例6: test

 /**
  * Deque test method.
  *
  * @param object IDeque $deque The deque to test.
  */
 public static function test(IDeque $deque)
 {
     printf("AbstractDeque test program.\n");
     for ($i = 0; $i <= 5; ++$i) {
         if (!$deque->isFull()) {
             $deque->enqueueHead(box($i));
         }
         if (!$deque->isFull()) {
             $deque->enqueueTail(box($i));
         }
     }
     printf("%s\n", str($deque));
     printf("getHead = %s\n", str($deque->getHead()));
     printf("getTail = %s\n", str($deque->getTail()));
     printf("Using reduce\n");
     $deque->reduce(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), '');
     printf("Using foreach\n");
     foreach ($deque as $obj) {
         printf("%s\n", str($obj));
     }
     printf("Dequeueing\n");
     while (!$deque->isEmpty()) {
         printf("%s\n", str($deque->dequeueHead()));
         if ($deque->isEmpty()) {
             break;
         }
         printf("%s\n", str($deque->dequeueTail()));
     }
 }
开发者ID:EdenChan,项目名称:Instances,代码行数:34,代码来源:AbstractDeque.php

示例7: rhcontent

function rhcontent()
{
    box("<h1>For everybody</h1>\r\n<p>\r\nAll of the workshop sessions take place in the Youth Hostel. Coffee and tea are povided in break times. Three kegs of the local Black Sheep Ale are available for self-service with an honesty box and other alcoholic drinks are available to buy from the Youth Hostel. You are welcome to bring your own alcohol to the ceilidh but not to consume at Grinton Lodge.\r\n</p>");
    box("<h1>Youth Hostel bunks</h1>\r\n<p>Most people stay in the Youth Hostel itself, in comfortable bunk rooms with provided bedding. Meals (breakfast, lunch and dinner) are included for all those in bunks, with an optional Friday evening meal at 7.00.</p>\r\n");
    box("<h1>Camping</h1>\r\n<p>\r\nThere is a camping field next to the Youth Hostel which is suitable for tents, although access by car to the camping field is difficult. (Actually, getting in is quite easy, but getting out can be tricky, particularly if the grass is wet.) Camper vans can stay in the courtyard of the Youth Hostel with access to a toilet, but no electric hook-up. Campers are  welcome to use the self-catering kitchen in the hostel.\r\n</p>");
    box("<h1>Pods</h1>\r\n<p>\r\nThere are a some self-catering pods in the grounds of the hostel, which are a bit like wooden teepees. The largest of these pods can sleep up to five people at a push, the smaller ones can sleep up to three.\r\n</p>\r\n");
    box("<h1>Bed and breakfast</h1>\r\n<p>\r\nThere is a range of bed and breakfast accommodation in the area which you would need to book independently. If you have difficulty finding somewhere appropriate then please let us know and we may be able to help.\r\n</p>");
}
开发者ID:stevenaeola,项目名称:swaledalesqueeze,代码行数:8,代码来源:accommodation.php

示例8: describe

 function describe($message, $closure, $timeout = null, $type = 'normal')
 {
     if (!Suite::current()) {
         $suite = box('kahlan')->get('suite.global');
         return $suite->describe($message, $closure, $timeout, $type);
     }
     return Suite::current()->describe($message, $closure, $timeout, $type);
 }
开发者ID:crysalead,项目名称:kahlan,代码行数:8,代码来源:init.php

示例9: buildTree

 /**
  * Builds an N-ary tree that contains character keys in the given range.
  *
  * @param integer lo The lower bound of the range.
  * @param integer hi The upper bound of the range.
  * @return An N-ary tree.
  */
 public static function buildTree($lo, $hi)
 {
     $mid = intval(($lo + $hi) / 2);
     $result = new NaryTree(2, box(chr($mid)));
     if ($lo < $mid) {
         $result->attachSubtree(0, self::buildTree($lo, $mid - 1));
     }
     if ($hi > $mid) {
         $result->attachSubtree(1, self::buildTree($mid + 1, $hi));
     }
     return $result;
 }
开发者ID:EdenChan,项目名称:Instances,代码行数:19,代码来源:Application2.php

示例10: test

 /**
  * SortedList test method.
  *
  * @param object ISortedList $list The list to test.
  */
 public static function test(ISortedList $list)
 {
     printf("AbstractSortedList test program.\n");
     $list->insert(box(4));
     $list->insert(box(3));
     $list->insert(box(2));
     $list->insert(box(1));
     printf("%s\n", str($list));
     $obj = $list->find(box(2));
     $list->withdraw($obj);
     printf("%s\n", str($list));
     printf("Using foreach\n");
     foreach ($list as $obj) {
         printf("%s\n", str($obj));
     }
 }
开发者ID:EdenChan,项目名称:Instances,代码行数:21,代码来源:AbstractSortedList.php

示例11: main

 /**
  * Main program.
  *
  * @param array $args Command-line arguments.
  * @return integer Zero on success; non-zero on failure.
  */
 public static function main($args)
 {
     printf("Box main program.\n");
     $status = 0;
     $box = box(false);
     printf("%s\n", str($box));
     $box = box(57);
     printf("%s\n", str($box));
     $box = box(1.5);
     printf("%s\n", str($box));
     $box = box('test');
     printf("%s\n", str($box));
     $box = box(array(1, 2, 3));
     printf("%s\n", str($box));
     return $status;
 }
开发者ID:EdenChan,项目名称:Instances,代码行数:22,代码来源:Box.php

示例12: rhcontent

function rhcontent()
{
    box("<h1>Concertina weekend 19-21 May 2017</h1>\n<p>Details of tutors are yet to be confirmed, but keep these dates in your diary if you'd like to come in 2017.</p>\n");
    /*
    box("<h1>Concertina weekend 20-22 May 2016</h1>
    <p>The guest tutors for the 2016 squeeze are Brian Peters (Anglo),
    Iris Bishop (Duet) and 
    Alex Wade (English), with additional workshops from Paul McCann (Duet)
    and Rob Say (English). Our regular tutors are Harry Scurfield (Anglo), Paul Walker (English/Anglo), Carolyn Wade (Band)  and Dave Ball (Band/English).</p>
    ");
    */
    /*
    Use the navigation links on the left hand side to find out 
    ore about the <a href='course.php'>tutors and course details</a>, <a href='accommodation.php'>accommodation</a> and <a href='booking.php'>booking</a>
    */
    box("<img src='images/friendly_concertina.jpg' alt='friendly concertina' height='313' align='center'/>   ");
}
开发者ID:stevenaeola,项目名称:swaledalesqueeze,代码行数:17,代码来源:index.php

示例13: test

 /**
  * DoubledEndedPriorityQueue test method.
  *
  * @param object IPriorityQueue $pqueue The queue to test.
  */
 public static function test(IPriorityQueue $pqueue)
 {
     printf("AbstractDoubledEndedPriorityQueue test program.\n");
     AbstractPriorityQueue::test($pqueue);
     printf("%s\n", str($pqueue));
     $pqueue->enqueue(box(3));
     $pqueue->enqueue(box(1));
     $pqueue->enqueue(box(4));
     $pqueue->enqueue(box(1));
     $pqueue->enqueue(box(5));
     $pqueue->enqueue(box(9));
     $pqueue->enqueue(box(2));
     $pqueue->enqueue(box(6));
     $pqueue->enqueue(box(5));
     $pqueue->enqueue(box(4));
     printf("%s\n", str($pqueue));
     while (!$pqueue->isEmpty()) {
         $obj = $pqueue->dequeueMax();
         printf("%s\n", str($obj));
     }
 }
开发者ID:EdenChan,项目名称:Instances,代码行数:26,代码来源:AbstractDoubleEndedPriorityQueue.php

示例14: rhcontent

function rhcontent()
{
    box("<h1>Tutors</h1>\r\n<p>The guest tutors for the 2016 squeeze are Brian Peters (Anglo),\r\nIris Bishop (Duet) and \r\nAlex Wade (English), with additional workshops from Paul McCann (Duet)\r\nand Rob Say (English). Our regular tutors are Harry Scurfield (Anglo), Paul Walker (English/Anglo), Carolyn Wade (Band)  and Dave Ball (Band/English). Together they provide workshops covering a whole range of concertina playing for different abilities, systems and styles.\r\n</p>");
    box("<h1>Timetable</h1>\r\n<p>\r\nThe weekend starts on Friday 20th May. We have two informal sessions including the Dotty session, with written music provided for the tunes. Saturday includes teaching workshops in the morning and afternoon, an informal tea-time concert and a ceilidh in the evening at Reeth Memorial Hall, with the band for the ceilidh and the 'spots' provided by participants. There are more workshops on Sunday morning before the farewell concert on Sunday afternoon, again in Reeth Memorial Hall, featuring spots from the tutors and their workshop groups. You can download more details on the <a href='2016/SwaledaleProgramme2016.pdf'>exact timings</a> and <a href='2016/SwaledaleWorkshopDetails2016.pdf'>workshop details</a>.</p>");
    box("<h1>Other features</h1>\r\n<p>\r\nOn Friday afternoon there is a walk around Swaledale for those who wish to join it. We also have Dave Elliott's concertina clinic and Chris Algar's (Barleycorn Concertinas) emporium on Saturday. Families and friends are welcome too - they may enjoy the area's many craft shops, tearooms and outstanding walks and are welcome to bring other musical instruments for joining in sessions or the ceilidh band. \r\n</p>");
}
开发者ID:stevenaeola,项目名称:swaledalesqueeze,代码行数:6,代码来源:course.php

示例15: box

<?php

namespace Chaos\Database\Spec\Suite;

use Lead\Set\Set;
use Chaos\ChaosException;
use Chaos\Database\DatabaseException;
use Chaos\Model;
use Chaos\Finders;
use Chaos\Database\Query;
use Chaos\Database\Schema;
use Chaos\Database\Spec\Fixture\Fixtures;
$box = box('chaos.spec');
$connections = ["MySQL" => $box->has('source.database.mysql') ? $box->get('source.database.mysql') : null, "PgSql" => $box->has('source.database.postgresql') ? $box->get('source.database.postgresql') : null];
foreach ($connections as $db => $connection) {
    describe("Query[{$db}]", function () use($connection) {
        beforeAll(function () use($connection) {
            skipIf(!$connection);
        });
        beforeEach(function () use($connection) {
            $this->connection = $connection;
            $this->fixtures = new Fixtures(['connection' => $connection, 'fixtures' => ['gallery' => 'Chaos\\Database\\Spec\\Fixture\\Schema\\Gallery', 'gallery_detail' => 'Chaos\\Database\\Spec\\Fixture\\Schema\\GalleryDetail', 'image' => 'Chaos\\Database\\Spec\\Fixture\\Schema\\Image', 'image_tag' => 'Chaos\\Database\\Spec\\Fixture\\Schema\\ImageTag', 'tag' => 'Chaos\\Database\\Spec\\Fixture\\Schema\\Tag']]);
            $this->fixtures->populate('gallery', ['create']);
            $this->fixtures->populate('gallery_detail', ['create']);
            $this->fixtures->populate('image', ['create']);
            $this->fixtures->populate('image_tag', ['create']);
            $this->fixtures->populate('tag', ['create']);
            $this->gallery = $this->fixtures->get('gallery')->model();
            $this->galleryDetail = $this->fixtures->get('gallery_detail')->model();
            $this->image = $this->fixtures->get('image')->model();
            $this->image_tag = $this->fixtures->get('image_tag')->model();
开发者ID:crysalead,项目名称:chaos-database,代码行数:31,代码来源:Query.spec.php


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