Skip to content

Instantly share code, notes, and snippets.

@mehrshaddarzi
Created April 16, 2025 08:09
Show Gist options
  • Save mehrshaddarzi/915b4b493c62112e67de7c7351eaa84d to your computer and use it in GitHub Desktop.
Save mehrshaddarzi/915b4b493c62112e67de7c7351eaa84d to your computer and use it in GitHub Desktop.
Replace persian character before search php mysql

SELECT * FROM table_name WHERE column_name LIKE '%ا%' OR column_name LIKE '%آ%';

SELECT * FROM table_name WHERE column_name REGEXP '[اآ]';

SELECT * FROM table_name WHERE REPLACE(column_name, 'آ', 'ا') LIKE '%ا%';

SELECT * FROM table_name WHERE column_name COLLATE utf8_persian_ci LIKE '%ا%';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment