Skip to content

Instantly share code, notes, and snippets.

@fadhil-riyanto
Created February 25, 2021 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fadhil-riyanto/64c2bf7226110f0f6fd37fa51ca4b96f to your computer and use it in GitHub Desktop.
Save fadhil-riyanto/64c2bf7226110f0f6fd37fa51ca4b96f to your computer and use it in GitHub Desktop.
<?php
$Block = array('asu','bangsat', 'njir'); // kata yang ingin diblok
$String = "asu, tadi njir, tadi ada orang bangsat !";
$String = preg_replace("/(\b|[0-9_])(".implode('|',$Block).")(\b|[0-9_])/i", '***', $String);
echo $String;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment