Skip to content

Instantly share code, notes, and snippets.

@joubertredrat
Created December 10, 2013 17:46
Show Gist options
  • Save joubertredrat/7894852 to your computer and use it in GitHub Desktop.
Save joubertredrat/7894852 to your computer and use it in GitHub Desktop.
Conceitual idea about switch and regex
<?php
$str = '[0710:020602938:7041]';
preg_switch($str) {
case '/^(\[)[A-Z0-9]{4}:(' . rand(10000,29999) . '|' . rand(50000,99999) . '):[A-z]{3}(\])(.*)+/':
/* ... */
break;
case '/^(\[)[A-Z0-9]{4}:[0-9]{9}:[0-9]{4}(\])+/':
/* ... */
break;
default:
/* ... */
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment