လက်ရှိတည်နေရာ: ပင်မစာမျက်နှာ> ဖန်ရှင်အမျိုးအစားများ> iterator_to_array

iterator_to_array

Eterator မှ iterator မှ etray မှကူးယူပါ
အမည်:iterator_to_array
အမျိုးအစား:ခွက်အပိုင်း
programming language:php
တစ်ကြောင်းဖြင့်အကျဉ်းချုပ်:တစ် ဦး iterator တစ်ခုခင်းကျင်းဖို့ပြောင်းလဲ

function name: iterator_to_array ()

function description: iterator ကို array တစ်ခုသို့ပြောင်းပါ

သက်ဆိုင်သောဗားရှင်း - PHP 5, PHP 7

အသုံးပြုမှု - Iterator_to_array (Iterator $ Itherator, Bool $ use_keys = true)

Parametermer

  • $ Itherator - array သို့ပြောင်းရန် Iterator Offerator ။
  • $ question_Keys (optional) - array ၏သော့အဖြစ်ကြားဖြတ်၏သော့ကိုအသုံးပြုရန်ရှိမရှိသတ်မှတ်သည်။ ပုံမှန်ကမှန်ပါတယ်

ပြန်လာတန်ဖိုး - ပြောင်းလဲထားသော array ကိုပြန်ပို့သည်။

ဥပမာ -

  1. iterator ကိုခင်းကျင်းရန်ပြောင်းလဲပြီးသော့များကိုသိမ်းထားပါ။
 $iterator = new ArrayIterator(['a' => 'apple', 'b' => 'banana', 'c' => 'cherry']); $array = iterator_to_array($iterator); print_r($array);

ထုတ်လုပ်မှု -

 Array ( [a] => apple [b] => banana [c] => cherry )
  1. သော့ချက်များကိုမသိမ်းဆည်းဘဲ iterator ကိုခင်းကျင်းရန်ပြောင်းလဲပါ -
 $iterator = new ArrayIterator(['apple', 'banana', 'cherry']); $array = iterator_to_array($iterator, false); print_r($array);

ထုတ်လုပ်မှု -

 Array ( [0] => apple [1] => banana [2] => cherry )

မှတ်စုများ

  • အကယ်. ITERATER မှသော့များသည်ထူးခြားသည်ဆိုပါကအောက်ပါတန်ဖိုးများသည်ယခင်တန်ဖိုးများကိုကျော်လွှားနိုင်သည်။
  • အကယ်. ထူးခြားသောသော့ကိုမသုံးပါကသော့ကိုမသိမ်းဆည်းပါကခင်းကျင်းမှု၏သော့များသည် 0 မှတိုးပွားလိမ့်မည်။
သက်ဆိုင်သောဖင်ခှ်ရှင်းများ
  • သတ်မှတ်ထားသောလူတန်းစားသို့မဟုတ် interface မှအကောင်အထည်ဖော်မှုအားလုံး interface များကိုပြန်သွားပါ class_implements

    class_implements

    သတ်မှတ်ထားသောလူတန်းစ
  • ရရှိနိုင် SLS အတန်းအားလုံးကိုပြန်သွားပါ spl_classes

    spl_classes

    ရရှိနိုင်SLSအတန်းအား
  • အဆိုပါ ITERator အတွက် element များ၏နံပါတ်တွက်ချက် iterator_count

    iterator_count

    အဆိုပါITERatorအတွက်e
  • သတ်မှတ်ထားသောအရာဝတ်ထု၏ hash ID ကိုပြန်ပို့သည် spl_object_hash

    spl_object_hash

    သတ်မှတ်ထားသောအရာဝတ်ထ
  • ITERATOR မှ Element တစ်ခုစီအတွက်အသုံးပြုသူသတ်မှတ်ထားသော function ကိုခေါ်ပါ iterator_apply

    iterator_apply

    ITERATORမှElementတစ်
  • အားလုံးမှတ်ပုံတင် __Autoload () လုပ်ဆောင်ချက်များကိုပြန်လည်ရောက်ရှိ spl_autoload_functions

    spl_autoload_functions

    အားလုံးမှတ်ပုံတင်__A
  • ပေးထားသောအရာဝတ်ထု၏ integer အရာဝတ်ထုလက်ကိုင်ပြန်ပို့ spl_object_id

    spl_object_id

    ပေးထားသောအရာဝတ်ထု၏in
  • ပေးထားသောအတန်းအစားအသုံးပြုသောစရိုက်များကိုပြန်ပို့သည် class_uses

    class_uses

    ပေးထားသောအတန်းအစားအသ
လူကြိုက်များသော ဆောင်းပါးများ