當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Arr::to_assoc方法代碼示例

本文整理匯總了PHP中Arr::to_assoc方法的典型用法代碼示例。如果您正苦於以下問題:PHP Arr::to_assoc方法的具體用法?PHP Arr::to_assoc怎麽用?PHP Arr::to_assoc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Arr的用法示例。


在下文中一共展示了Arr::to_assoc方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: test_to_assoc_with_odd_number_of_elements

 /**
  * Tests Arr::to_assoc()
  *
  * @test
  */
 public function test_to_assoc_with_odd_number_of_elements()
 {
     $arr = array('foo', 'bar', 'baz');
     $expected = null;
     $this->assertEquals($expected, Arr::to_assoc($arr));
 }
開發者ID:quickpacket,項目名稱:noclayer,代碼行數:11,代碼來源:arr.php

示例2: to_assoc

 /**
  * Converts the current URI segments to an associative array.  If
  * the URI has an odd number of segments, an empty value will be added.
  *
  * @param  int  segment number to start from. default value is the first segment
  * @return  array  the assoc array
  */
 public static function to_assoc($start = 1)
 {
     $segments = array_slice(static::segments(), $start - 1);
     count($segments) % 2 and $segments[] = null;
     return \Arr::to_assoc($segments);
 }
開發者ID:SainsburysTests,項目名稱:sainsburys,代碼行數:13,代碼來源:uri.php

示例3: to_assoc

 /**
  * Converts the current URI segments to an associative array.  If
  * the URI has an odd number of segments, null will be returned.
  *
  * @return  array|null  the array or null
  */
 public static function to_assoc()
 {
     return \Arr::to_assoc(static::segments());
 }
開發者ID:reganhimself,項目名稱:KeeleProgrammers,代碼行數:10,代碼來源:uri.php

示例4: test_to_assoc_with_odd_number_of_elements

 /**
  * Tests Arr::to_assoc()
  *
  * @test
  * @expectedException BadMethodCallException
  */
 public function test_to_assoc_with_odd_number_of_elements()
 {
     $arr = array('foo', 'bar', 'baz');
     Arr::to_assoc($arr);
 }
開發者ID:SainsburysTests,項目名稱:sainsburys,代碼行數:11,代碼來源:arr.php


注:本文中的Arr::to_assoc方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。