Getting specific parts from a string to another

The Real Hero

I have a string variable like following

$str= '[[["how ","no use","",""],["to ","no use","",""],["solve this","no use","",""]]]';

And i want some parts of this string to make another one like following

$result="how to solve this";

Is it possible to create $result from $str?

Am new to php someone help me to solve this or any idea to solve this.

castis

since the string is json, you can use json_decode to turn that string into an array. Since the whole thing is wrapped in [], reset is used to shear off the out outer array.

$string= '[[["how ","no use","",""],["to ","no use","",""],["solve this","no use","",""]]]';

$result = '';
foreach(reset(json_decode($string)) as $piece)
{
    $result .= reset($piece);
}

echo $result;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Getting Specific thing from a string

From Dev

Extracting specific parts of a String

From Dev

PHP preg_replace remove specific parts from string

From Dev

How to replace specific parts in string with javascript with values from object

From Dev

How to remove whitespaces and linebreaks from specific parts of a string?

From Dev

Replace specific parts of string in PHP

From Dev

Select specific parts in string array

From Dev

Getting string from another class and transfering it to url

From Dev

getting parts of a wxpython program to communicate with one another

From Dev

Remove specific parts from url

From Dev

Remove specific parts from url

From Dev

Copy same specific parts of a file to another file

From Dev

c# regular expression getting specific string from string[CLOSE]

From Dev

Getting address parts out of address string

From Dev

Getting certain parts of a string out of a select

From Dev

Split String in small specific length parts and return all those parts

From Dev

Removing parts of the path from string

From Dev

Regular expression in PHP : retrieve a specific string from another string

From Dev

PHP: How to check for and uppercase specific parts of a string?

From Dev

How to print only specific parts of a string in java?

From Dev

Regex to return different parts if starts with specific string

From Dev

How to print out specific parts of a string

From Dev

Getting Orchard fields from different parts

From Dev

Getting a String to another activity

From Dev

Getting a specific field from a JSON string without deserializing in C#

From Dev

getting character from string that is after specific chars (java)

From Dev

Getting a specific field from a JSON string without deserializing in C#

From Dev

Getting specific range of characters from a string swift 3

From Dev

Java Getting String from another class returning null

Related Related

  1. 1

    Getting Specific thing from a string

  2. 2

    Extracting specific parts of a String

  3. 3

    PHP preg_replace remove specific parts from string

  4. 4

    How to replace specific parts in string with javascript with values from object

  5. 5

    How to remove whitespaces and linebreaks from specific parts of a string?

  6. 6

    Replace specific parts of string in PHP

  7. 7

    Select specific parts in string array

  8. 8

    Getting string from another class and transfering it to url

  9. 9

    getting parts of a wxpython program to communicate with one another

  10. 10

    Remove specific parts from url

  11. 11

    Remove specific parts from url

  12. 12

    Copy same specific parts of a file to another file

  13. 13

    c# regular expression getting specific string from string[CLOSE]

  14. 14

    Getting address parts out of address string

  15. 15

    Getting certain parts of a string out of a select

  16. 16

    Split String in small specific length parts and return all those parts

  17. 17

    Removing parts of the path from string

  18. 18

    Regular expression in PHP : retrieve a specific string from another string

  19. 19

    PHP: How to check for and uppercase specific parts of a string?

  20. 20

    How to print only specific parts of a string in java?

  21. 21

    Regex to return different parts if starts with specific string

  22. 22

    How to print out specific parts of a string

  23. 23

    Getting Orchard fields from different parts

  24. 24

    Getting a String to another activity

  25. 25

    Getting a specific field from a JSON string without deserializing in C#

  26. 26

    getting character from string that is after specific chars (java)

  27. 27

    Getting a specific field from a JSON string without deserializing in C#

  28. 28

    Getting specific range of characters from a string swift 3

  29. 29

    Java Getting String from another class returning null

HotTag

Archive