Jump to content

davidkierz

Members
  • Posts

    21
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

davidkierz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. $linnewline = "\n"; $emptyline = "></"; $lines = explode($linnewline,$xml); unset($xml); $xml = ""; foreach ($lines as $line) { if (strpos($line,$emptyline) !== false) { $spaces = 0; for ($i = 0; $i<strlen($line); $i++){ if ($line[$i] != " "){ break; } $spaces=$spaces+1; } $split = explode($emptyline, $line); $newline = $split[0] . ">\n" . str_repeat(" ", $spaces) . "</" . $split[1]; $xml = $xml . $newline . $linnewline; } else { $xml = $xml . $line . $linnewline; } } ugh.. its ugly and slow. but it works..
  2. okay i think what ill do it break the string into an array of lines check each line to see if its empty if it is remove the closing tag, count how many indents, insert new indented line into array with closing tag EDIT the xml is encoded into binary and encrypted, signed, and hashed i need to create the exact same output. this is the only difference. there are thousands of different tags that may or may not be empty, my example is only a simplification
  3. i though about that but it would have to do the indent also
  4. i need to replicate this strange dotnet behavior exactly. <?xml version="1.0"?> <library> <book> <Title>Green Eggs And ham</Title> <page> </page> </book> </library> nodes that are empty have the closing tag on a new, indented line. Nodes with content have the closing on the same line. in php, i am saving my xml with $xml = $dom->saveXML($dom, LIBXML_NOEMPTYTAG) which pretty closely matches this, with the excepton of empty nodes having the closing tag on the same line <?xml version="1.0"?> <library> <book> <Title>Green Eggs And ham</Title> <page></page> </book> </library> i dont see option for placing closing tags for empty nodes on new lines, any ideas how i can go about recreating this behavior?
  5. yeah thats what i was gonna use i just thought there was a built in function in php that did it already...
  6. sorry guys i been messing around with a this stupid program and im gettin tired. isnt there a builtin function that will return the day of week via a supplied integer from 1 - 7 1 = monday 2 = tuesday etc.etc...
  7. sorry to wake up a solved old thread but i got a another question... now that i have my sql database populated with events timestamped with unixtime, is there a way i can use a sql command to select rows based on the day of week? i would assume there would have to be a built in time function..... any ideas?
  8. i like the timestamp option, as it seems the most accurate i am going to change my sql date variable to handle the date as a timestamp rather than date, and adjust my code accordingly thanks to all
  9. supposed i have 2 dates $date1 and $date2 they are in this format "2008-10-09" how would i word the code to figure out the number of days between them like $date2 - date1 = 15 days ?
  10. basically i am processing raw html to look for a certain string and since the html file changes everytime the script runs, i cant use substr directly i think i have to use a combination of substr and strpos but cat figure it out
  11. looking for a function that will do this $string = "adam baker charlie david edward frank"; $result = function($string, "baker", "david"); $result = charlie
  12. exec("ping -n -c 4 $ip 2>&1", $output, $retval);
  13. how would i code a function that returns the text in $string between $start and $end not including $start and $end ??????
  14. can anyone suggest a alternative program to sox for determining the audio length of a audio file
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.