How to push hash into array of hash in php?

后端 未结 4 1309
梦谈多话
梦谈多话 2021-01-16 10:02

Like array_push() where we can push an element in to array. I want to push an hash [name,url] in to an array of hash.

4条回答
  •  孤街浪徒
    2021-01-16 10:50

    ifif i understand your problem, you want to retrieve hash value from a url then use parse_url with PHP_URL_FRAGMENT argument

    $url = 'http://username:password@hostname/path?arg=value#anchor';
    
    print_r(parse_url($url));
    
    echo parse_url($url, PHP_URL_FRAGMENT);
    

    will return

     [fragment] => anchor
    

    Reference

提交回复
热议问题