|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I've recenty transformed some XML with XSL and PHP. as shown in the code below. Now i need to split the $html string (which is the resultant HTML output of the XML file) into single characters instead of printing it to screen. Inhave tried the ususal PHP methods for splitting a string, nothing seems to work. I have also tried putting the string into an array. Again, nothing works. Could anyone please help me? <?php // Create an XSLT processor $xsltproc = xslt_create(); // Perform the transformation $html = xslt_process($xsltproc, 'results1.xml', 'results1.xsl'); // Detect errors if (!$html) die('XSLT processing error: '.xslt_error($xsltproc)); // Destroy the XSLT processor xslt_free($xsltproc); //print out the HTML echo $html; ?> Thanks Jo |
|
#2
|
||||
|
||||
|
Did you try splitting on an empty string? Failing that, you could iterate over the string using strlen() as your counter and strpos() to get the current character.
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
|
#3
|
||||
|
||||
|
Why the heck do you want it in single characters?
Whatever, the following function returns an array containing the characters of the inputted string as entries. Hope it helps. PHP Code:
Hope it's of use. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > splitting PHP strings |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|