title: PHP - Check a string and create a page structure from input
body: <p>I'm trying to write a script for a page structure system where ideally the user enters in a page structure in a certain way and then the script outputs it in a slightly different way. It's very difficult to explain but what I want is for this;</p>
  <blockquote>
  <p>= Section 1</p>
  <p>Page 1</p>
  <p>Page 2</p>
  <p>= Section 2</p>
  <p>Page 1</p>
  <p>Page 2</p>
  </blockquote>
  <p>To be turned into the following;</p>
  <blockquote>
  <p>Section 1\section-1||Page 1</p>
  <p>Section 1\section-1||Page 2</p>
  <p>Section 2\section-2||Page 1</p>
  <p>Section 2\section-2||Page 2</p>
  </blockquote>
  <p>So essentially the input is formatted into a site structure that can be inserted into another system that can generate pages for a website. It's a long story but how can this be achieved? I'm not new to PHP but still very much at a junior/beginner level.</p>
  <p>So each &quot;section&quot; is a category and of course each page... is a page. Any help please?</p>