Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You misunderstand the difference between <a href="http://php.net/manual/en/language.types.string.php" rel="nofollow">strings</a> and <a href="http://php.net/manual/en/language.types.array.php" rel="nofollow">arrays</a> in PHP. Distinguishing between the two is <strong>critical</strong>. I'll assume your data is in string format.</p> <p>String manipulation to the rescue! If there's no identifiable pattern or format to your data, extracting the desired information will be difficult. If your string <em>always</em> begins with <code>test type:</code> and the value following it <em>always</em> ends with a semicolon, you might do something as follows (not ideal, but it's simple):</p> <pre><code>$str = 'test type: human; Including all the test; number of participants 2 persons + additional $50'; $testType = substr($str, 11, strpos($str, ';')-11); // 11 == len('test type: ') </code></pre> <p>Similarly, if your string always contains the text <code>number of participants</code> immediately before the desired data, and if there is a space immediately after that data, you might use:</p> <pre><code>$start = strpos($str, 'number of participants') + 23; $numPart = substr($str, $start, strpos($str, ' ', $start+1) - $start); </code></pre> <p>I hardcoded the indices for brevity, but they're easily replaced with string search functions (especially regex).</p> <p>Resources:</p> <ul> <li><a href="http://php.net/manual/en/ref.strings.php" rel="nofollow">String Functions in PHP</a></li> <li><a href="http://php.net/manual/en/function.substr.php" rel="nofollow"><code>substr</code> (substring)</a></li> <li><a href="http://php.net/manual/en/function.strpos.php" rel="nofollow"><code>strpos</code> (basic search)</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload