Skip to content

Instantly share code, notes, and snippets.

@kurudrive
Created December 1, 2013 18:17
Show Gist options
  • Save kurudrive/7738772 to your computer and use it in GitHub Desktop.
Save kurudrive/7738772 to your computer and use it in GitHub Desktop.
php の文字列置換例文
$subject = '<div id="pickId_4046"></div><div id="pickId_3077"></div><div class="888"></div>';
$subject = esc_html(file_get_contents( site_url() ));
$not_in_array = '';
$pattern = '/id="pickId_([0-9]+)"/';
preg_match_all($pattern,$subject,$out, PREG_PATTERN_ORDER);
$not_in_array = $out[1]; // [0]はマッチした条件部分の配列
print '<pre>';print_r($not_in_array);print '</pre>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment