开发者

How to process this array using php?

开发者 https://www.devze.com 2023-02-07 20:16 出处:网络
I am importing users data from a csv file. After uploading me got this kind of a an array CRF_Tester_Import_Parser_TesterData Object

I am importing users data from a csv file. After uploading me got this kind of a an array

CRF_Tester_Import_Parser_TesterData Object
(
    [_mapperKeys:protected] => Array
        (
        )

    [_contactIdIndex:private] => 
    [_newTeachers:protected] => Array
        (
        )

    [_fileName:protected] => 
    [_fileSize:protected] => 0.23
    [_seperator:protected] => ,
    [_lineCount:protected] => 5
    [_totalCount:protected] => 4
    [_validCount:protected] => 4
    [_invalidRowCount:protected] => 0
    [_maxErrorCount:protected] => 250
    [_errors:protected] => Array
        (
     开发者_StackOverflow中文版   )

    [_conflictCount:protected] => 0
    [_conflicts:protected] => Array
        (
        )

    [_duplicateCount:protected] => 
    [_duplicates:protected] => 
    [_warningCount:protected] => 0
    [_maxWarningCount:protected] => 25
    [_warnings:protected] => Array
        (
        )

    [_fields:protected] => 
    [_activeFields:protected] => 
    [_activeFieldCount:protected] => 1
    [_maxLinesToProcess:protected] => 100
    [_rows:protected] => Array
        (
            [0] => Array
                (
                    [0] => Contact ID,First Name,Email,Contribution Type,External Identifier,date,Total Amount
                )

            [1] => Array
                (
                    [0] => 1001,abc,abc@abc.com,aaa,active,2011-1-10,100
                )

            [2] => Array
                (
                    [0] => 1002,fff,fff@fff.com,yes+,active,2010-11-05,200
                )

            [3] => Array
                (
                    [0] => 1003,ggg,kkk@kkk.com,basic,active,2011-1-20,300
                )

        )

    [_errorFileName:protected] => 
    [_conflictFileName:protected] => 
    [_duplicateFileName:protected] => 
    [_haveColumnHeader:protected] => 
    [_contactType] => Individual
)

From this array how can I process "_rows:protected" key values?


I guess you have problems because of the colon in the member-name, try it like this:

foreach($CRF_Tester_Import_Parser_TesterData->{'_rows:protected'} as $k=>$item)
{
  echo $item[0];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消