Overview

Namespaces

  • Kotchasan
    • Cache
    • Database
    • Http
    • Log
    • Orm
  • None
  • PDF
  • PHP
  • Psr
    • Cache
    • Http
      • Message
    • Log

Classes

  • Accordion
  • ArrayTool
  • CKEditor
  • Collection
  • Config
  • Controller
  • Country
  • Csv
  • Curl
  • Currency
  • Database
  • DataTable
  • Date
  • DOMNode
  • DOMParser
  • Email
  • File
  • Files
  • Form
  • Grid
  • Html
  • Htmldoc
  • HtmlTable
  • Image
  • InputItem
  • Inputs
  • KBase
  • Language
  • ListItem
  • Login
  • Menu
  • Mime
  • Model
  • Number
  • Object
  • Password
  • Pdf
  • Province
  • Router
  • Singleton
  • Tab
  • TableRow
  • Template
  • Text
  • Validator
  • View
  • Overview
  • Namespace
  • Class
  • Tree

Class Object

Object tools.

Namespace: Kotchasan
Author: Goragod Wiriya admin@goragod.com
Since: 1.0
Located at Kotchasan/Object.php
Methods summary
public static array
# columns( array $array, string $column_key, mixed $index_key = null )

คืนค่ารายการที่มีคอลัมน์ตามที่กำหนด.

คืนค่ารายการที่มีคอลัมน์ตามที่กำหนด.

Parameters

$array
$column_key
ชื่อคอลัมน์ที่ต้องการ
$index_key
null คืนค่า index ของ $array, string คืนค่า index จากคอลัมน์ที่กำหนด

Returns

array

Assert

(array((object)array('id' => 1, 'name' => 'one'), (object)array('id' => 2, 'name' => 'two'), (object)array('id' => 3, 'name' => 'three')), 'name') [==] (object)array(0 => 'one', 1 => 'two', 2 => 'three')
(array((object)array('id' => 1, 'name' => 'one'), (object)array('id' => 2, 'name' => 'two'), (object)array('id' => 3, 'name' => 'three')), 'name', 'id') [==] (object)array(1 => 'one', 2 => 'two', 3 => 'three')
public static object
# replace( object $a, array|object $b )

ฟังก์ชั่นรวม object แทนที่คีย์เดิม

ฟังก์ชั่นรวม object แทนที่คีย์เดิม

Parameters

$a
$b

Returns

object

Assert

((object)array('one' => 1), array('two' => 2)) [==] (object)array('one' => 1, 'two' => 2)
((object)array('one' => 1), (object)array('two' => 2)) [==] (object)array('one' => 1, 'two' => 2)
public static array
# search( array $input, mixed $key, mixed $search )

ค้นหา object จาก property คืนค่าทุกรายการที่พบ รักษา index ตาม array ของ object ต้นฉบับ และ คืนค่าแอเรย์ว่างถ้าไม่พบ.

ค้นหา object จาก property คืนค่าทุกรายการที่พบ รักษา index ตาม array ของ object ต้นฉบับ และ คืนค่าแอเรย์ว่างถ้าไม่พบ.

Parameters

$input
ข้อมูลแอเรย์ ของ object
$key
property ที่ต้องการค้นหา
$search
ข้อความค้นหา

Returns

array

Assert

(array((object)array('id' => 1, 'name' => 'one'), (object)array('id' => 2, 'name' => 'two'), (object)array('id' => 3, 'name' => 'one')), 'name', 'one') [==] array(0 => (object)array('id' => 1, 'name' => 'one'), 2 => (object)array('id' => 3, 'name' => 'one'))
(array((object)array('id' => 1, 'name' => 'one'), (object)array('id' => 2, 'name' => 'two'), (object)array('id' => 3, 'name' => 'one')), 'id', 'one') [==] array()
kotchasan API documentation generated by ApiGen