Jump to content
Stef's Coding Community


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About syn3rgy

  • Rank
    New member
  1. For free why not just try it? I am new to PHP but the first thing I did was download Eclipse and load the color theme plug-in and the proj-x transfer plug-in. So now it looks like Notepad++ but I get code templates (like auto-completion), syntax checking, and with a key stroke I can upload my files to the FTP server. Its also pretty cool to have a function or class in a referenced include and when you instantiate it in, it will find, auto-complete and show you the parameters. Its like having a perfect memory. For OOP I can't imagine not having that sort of functionality.
  2. I cant seem to get preg_replace to work on an array that contains two strings. var_dump of the array $catarray looks like this: array(2) { [0]=> string(407) "category1\ncategory2\ncategory3\ncategory4" [1]=> string(1026) "category1\ncategory2\ncategory3\ncategory4\ncategory5" } I am trying to eliminate the line breaks "\n" and replace them with ",". The code I wrote to try this is: $test = preg_replace("(\n)",",",$catarray); var_dump($test); The dump looks exactly the same as the before I ran the preg_replace. If I run the code on a simple string like "cat
  3. syn3rgy

    Arrays in Loops

    Wow doh! I have no idea why I didn't think of laying out the array that way. This is what I have now: $file = "rsform.xml"; $xml = simplexml_load_file($file); $i = 0; //get data from XML tags foreach($xml->submissions->submission as $item) { //store those in array for later $basic[$i]["name"] = (string)$item->name; $basic[$i]["email"] = (string)$item->email; $basic[$i]["address"] = (string)$item->address; $basic[$i]["city"] = (string)$item->city; $basic[$i]["state"] = (string)$item->state; $basic[$i]["zip"] = (string)$item->zip; $basic[$i]["phone"] =
  4. syn3rgy

    Arrays in Loops

    As I have been going through the tutorials, I wanted to try and use what I'm learning.I came across the need to export values from an XML file to a CSV file. Looking at examples in the PHP manual and trying to use what I have been learning I have started the script. The XML layout looks like this: <?xml version="1.0" encoding="utf-8"?> <form> <title><![CDATA[submit Directory Profile Information]]></title> <submissions> <submission> <name><![CDATA[Joe Mama]]></name> <email><![CDATA[enter@here.com]]></email>
  5. First off let me tell you I am an absolute PHP beginner. I have a similar need and just so happen to be also working off the same tutorial. In your example, to get the information in the tags you can do this: <?php $file = "phonebook.xml"; $xml = simplexml_load_file($file); //get data from XML tags and store in array foreach($xml->note as $item) { $info = array( "name" => $item->name, "number" => $item->number, "address" => $item->address, "email" => $item->email ); //simple echo out echo "<br />"; print $info["name"]; echo "<br />"; p
  • Create New...