php - Isolating a specific value from complicated array returned from API call -
I am working with API for language classifier. I make a classifier, add two classes, train them, and then send a string to be classified. The response to the classification call is an array:
$ response = $ uclassify-> Categorize ($ big string, $ title); Print_r ($ response); The following string is printed by calling print_r on the response (I've tabbed it and tried to understand it):
Array ([0] = & Gt; array ([ID] => classified 12 911363801322 [classification] => Array ([0] => Array ([class] => Cool [P] = & Gt; ** 0.636574 **) [1] = & Gt; array ([class] => uncool [p] => ** 0.363426 **)) [text] =>) The only part of the array is that I am interested in the number (put in bold) I want to remove these two numbers. A print statement to write?
Edit: Inappropriate print_r:
Array ([0] => Array ([ID] => Classistife 12 911363801322 [classification] => Array ( [0] = & gt; array ([class] = & gt; cool [p] => 0.636574) [1] => Hey ([square] => Uncool [p] = & gt; 0.363426)) [text] => heavy text string)
$ numbers = Array (); Foreign currency ($ reaction [0] [$ classification]] as $ o {$ numbers} = $ o ['p']; } Print_r ($ numbers);
Comments
Post a Comment