0

I am executing a php script and getting the following results:

[{"0":"1010100000100000100","nonnull_columns":"1010100000100000100"}]

can I extract the string quoted in second quote i.e. 1010100000100000100??

1

1 Answer 1

0

It's an object inside an array.

$json_string = '[{"0":"1010100000100000100","nonnull_columns":"1010100000100000100"}]';
$json_decoded = json_decode($json_string);
$first_element = $json_decoded[0];
$nonnull_columns = $first_element->nonnull_columns;

Above code can of course be shortened.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.