Skip to content

Instantly share code, notes, and snippets.

@basz
Created September 24, 2012 21:18
Show Gist options
  • Select an option

  • Save basz/3778443 to your computer and use it in GitHub Desktop.

Select an option

Save basz/3778443 to your computer and use it in GitHub Desktop.
$accept = $headers->get('Accept');
$match = $accept->match('application/json, application/javascript, application/rss+xml, application/atom+xml');
var_dump($match);
object(Zend\Http\Header\Accept\FieldValuePart\AcceptFieldValuePart)[301]
private 'internalValues' (Zend\Http\Header\Accept\FieldValuePart\AbstractFieldValuePart) =>
object(stdClass)[302]
public 'typeString' => string '*/*' (length=3)
public 'type' => string '*' (length=1)
public 'subtype' => string '*' (length=1)
public 'subtypeRaw' => string '*' (length=1)
public 'format' => string '*' (length=1)
public 'priority' => string '0.8' (length=3)
public 'params' =>
array (size=1)
'q' => string '0.8' (length=3)
public 'raw' => string '*/*;q=0.8' (length=9)
public 'matchedAgainst' =>
object(Zend\Http\Header\Accept\FieldValuePart\AcceptFieldValuePart)[303]
private 'internalValues' (Zend\Http\Header\Accept\FieldValuePart\AbstractFieldValuePart) =>
object(stdClass)[304]
public 'typeString' => string 'application/json' (length=16)
public 'type' => string 'application' (length=11)
public 'subtype' => string 'json' (length=4)
public 'subtypeRaw' => string 'json' (length=4)
public 'format' => string 'json' (length=4)
public 'priority' => int 1
public 'params' =>
array (size=0)
...
public 'raw' => string 'application/json' (length=16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment