- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
var_dump(preg_match('/^\d+$/', "123"));
var_dump(preg_match('/^\d+$/', "123\n"));
var_dump(preg_match('/^\d+$/', "\n123\n"));
echo "---------\n";
var_dump(preg_match('/^\d+$/D', "123"));
var_dump(preg_match('/^\d+$/D', "123\n"));
var_dump(preg_match('/^\d+$/D', "\n123\n"));