Note that there are some explanatory texts on larger screens.

plurals
  1. POphp - get character count between two points encased in quotes
    primarykey
    data
    text
    <p>Ok this is going to be weird but I need it</p> <p>I am trying to get the character count for a huge line of code between some particular quotes ". Basically I need to be able to get everything between the 3rd quote in the beginning and the 5th quote at the end.</p> <p>So here is an example</p> <pre><code>a:2:{s:10:"categories";s:5758:"...........";s:5:"posts";s:6:"a:0:{}";} </code></pre> <p>I need to know what the character count is of all the periods. There is actually code in place of those periods.</p> <p>Since there are 11 periods then my character count will be 11. The only consistent thing is the quotes in this so I need to base off that.</p> <p>Any help would be awesome.</p> <p>Here is my code. I am basically creating the code and adding some custom labels. I tried serializing the code first before I unserialize it but that didn't seem to work.</p> <pre><code>&lt;? $thisisit .= 'a:2:{s:10:"categories";s:5481:"a:40:{'; include('connect.php'); $sql = "SELECT * FROM wp_terms ORDER BY term_id ASC LIMIT 40"; $result = mysql_query($sql); $count = 0; while($row = mysql_fetch_array($result)) { $name = $row['name']; $charactercount = strlen($name); $term_id = $row['term_id']; $thisisit .= 'i:'.$count.';a:2:{s:11:"filter_name";s:20:"add_keyword_category";s:11:"filter_args";a:7:{s:12:"filter_value";s:'.$charactercount.':"'.strtolower($name).'";s:19:"filter_search_title";s:1:"1";s:21:"filter_search_excerpt";i:0;s:21:"filter_search_content";s:1:"1";s:21:"faf_filter_categories";a:1:{i:4;s:3:"'.$term_id.'";}s:17:"filter_match_word";i:0;s:17:"filter_match_case";i:0;}}'; //echo "&lt;br&gt;&lt;br&gt;"; $count++; } $thisisit .= '}";s:5:"posts";s:6:"a:0:{}";}'; $array = unserialize($thisisit); echo strlen($array['categories']); ?&gt; </code></pre>
    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.
 

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