get a single value of array items in php

后端 未结 3 780
故里飘歌
故里飘歌 2021-01-22 09:18

I have an array in my php code, but I don\'t know how to get the value of it.

my array :

$year =  array(
    \'data\' => to_html(strtr(to_lang(\'main         


        
相关标签:
3条回答
  • 2021-01-22 09:47

    This should work: $stringyear = $year['data']['^year'];

    0 讨论(0)
  • 2021-01-22 09:49

    You are able to access it as follows:

    $stringyear = $year[1]['^year'];
    
    0 讨论(0)
  • 2021-01-22 09:59

    It depends on what to_html function returns, If it returns a string (for displaying in html), then you can not get it (You can but you need to parse the string again).

    Since you have the $timestamp, why not just do with:

    $stringyear = date('Y', $timestamp);
    
    0 讨论(0)
提交回复
热议问题