get some sub-string from string
I m working on some editor. So when i make a ajax call to one API. its returne me plain text string as follows:
"ew" : "umakant",
"hws" : [
I want to fetch that 1. It is one example. there may be some unicode text.
or some alphanumeric text.
Is there some way in PHP to get that string..?
but you made a mistake...
you thought 1 from "while(1)" but i want 1 from below row.
You can use json_decode() to turn it into a multidimensional array, but you'll need to first strip out that while statement. You could use substr() to cut the first 11 or whatever characters off, and then trim() it to take care of any remaining whitespace.
thanks. but just one more question.
can you tell me that suppose if i have some utf8 unicode values instead of
that 1, b or c..
will substring function create a problem ?
If you're just using substr() to remove the junk at the start of the string before passing to json_decode(), it will be ok.