Search the Community
Showing results for tags 'explode'.
-
I am able to retrieve data from a js like this: <!DOCTYPE html> <html> <body> <script> var a=[1,2,3,4] </script> <?php $ap= "<script> document.write(a) </script>"; print_r ($ap); $b=explode(',',$ap); print_r($b); ?> </body> </html> Result: 1,2,3,4Array ( [0] => 1,2,3,4 ) Why is the array not explode
-
- php
- javascript
-
(and 2 more)
Tagged with:
-
I am using the code below to extract some information from a website: $doc = new DOMDocument();$doc->loadHTML($html);$xpath = new DomXpath($doc); foreach($xpath->query('//img/@alt') as $node){ echo $node->nodeValue."|";} An example of the output is: 1|3|.5|statusB|8|5|.0| I want to use the code below to split this output in parts: $splitdata = explode('|', $input);echo "$splitdata[0], $splitdata[1], $splitdata[2], $splitdata[3], $splitdata[4], $splitdata[5], $splitdata[6]"; But how can I get the output from echo $node->nodeValue."|"; into the string $input?