Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8103035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:24:25+00:00 2026-06-05T23:24:25+00:00

EDIT: Parsed the array completely (it contained unparsed JSON!) array(22) { [0]=> array(4) {

  • 0

EDIT: Parsed the array completely (it contained unparsed JSON!)

array(22) {
  [0]=>
array(4) {
["responseData"]=>
array(1) {
  ["translatedText"]=>
  string(163) "21558299 this is the text that i want to end up with, excluding the id number at the start of the string"
}
["responseDetails"]=>
string(0) ""
["responseStatus"]=>
int(200)

The string I want to search for is the 2155.. and IFF it’s present, I want to get the string that’s after it… How can I do this? Any help much appreciated! (Or a better solution…?)

What I need is a return boolean telling me if the ID is actually contained within array – if it is, I need the text. If it’s not, I need to know as I want to put some other text (not relevant here).

Disclaimer: Gonna give this one to nickb, he’s been beyond awesome.

EDIT: This part is irrelevant now:


This is what I got so far, but it’s returning null. $trans_json is the array quoted above. $search[id] is another array, that holds the id string.

$return = array_filter( $trans_json, function($el) { 
    if( !( $start = strpos( $el, $search[id]) === false)) {
            $str =  substr( $el, $start);
            return substr( $str, 0, strpos( $str, '}'));
    }
            return null;
    });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:24:27+00:00Added an answer on June 5, 2026 at 11:24 pm

    Use array_walk():

    Your example isn’t working because $search is undefined. You need a closure (note the use ($search):

    $search['id'] = '2s5d56b9712';
    $return = array_walk( $trans_json, function( &$el) use( $search) { 
        if( !( ($start = strpos( $el, $search['id'])) === false)) {
            $str =  substr( $el, $start);
            $el = substr( $str, strlen( $search['id']) + 1, strpos( $str, '}'));
        }
    });
    
    var_dump( $trans_json);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: iam using ajax to load text in my content that is why onload
EDIT : It turned out that this can only be done through an external
Per example below...Looping through an object from a parsed JSON string returns an error
I am building a request in Flash that contains a JSON encoded Array of
I want to parse this JSON string using Gson {name:name,type:[a,b,c]} is it possible? 1st
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
EDIT: I was an idiot. I simply had an image that was vertically long,
EDIT: See my answer below--> I am wanting to have a view that when
Edit : Note that, as Daniel and latkin noted in an answer and a
I want to receive an array that contains all the h1 tag values from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.