Extract value from an array in php -


In my code, $ returns an array of data that is trying to remove the [2] value in that array I am For some reason it gives the entire array instead of just the value that I am trying to remove. I think it's really simple and I'm just looking at something.

Here's my code:

  $ url = 'https://sandbox.familysearch.org/ forum / tree / person / KWWM-5R1 / Portrait? Access_token = '$ _SESSION [' FS-session ']; $ Return = print_a (get_headers ($ url)); $ Return return [2];  

and there is a harvesting from the array printed here:

  array ([0] => HTTP / 1.1 307 temporary redirection [1] = & Gt; Server: Apache-Coyote / 1.1 [2] = & gt; Location: https://integration.familysearch.org/sandbox/v2/TH-501-48051-27-34/thumb200.jpg?ctx= ArtCtxPublic)  

How can I get the [2] value? Try to get rid of print_r

  $ return = get_headers ($ url); $ Return return [2];  

print_r is a function used to print information from a variable (your array, in terms of its content). You want that instead of the header add, you set the value of $ return to print_r as the return value (which is just true ).


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -