Sunday, September 27, 2015

Anagram and Rhyme Generator

I had some fun today with Anagram Generator and Rhyme Generator. For those who are unfamiliar with these, anagrams are rearrangements of the letters in a word. And of course, the rhyme tool is very useful if you want to do poetry.

Saturday, September 26, 2015

Allow PHP in Posts and preg_match

Allow PHP in Posts is a very cool plugin when you need to execute PHP in your posts, but you need a little time to get used to it, because it is kind of tricky. For instance I did not manage to use the preg_match function with square brackets. It simply replaces [a-z] with <a-z>. The only fix I could find is to use Code Snippets and add all the preg_match parts there, then use Shortcodes like [php function=5].

Also don't forget about [PHP debug=1] option which can be really useful.

Monday, September 21, 2015

remove accents and diacritics from a string in PHP

I needed to remove some diacritics from a text and the easiest way I've found is this:
$newstring = iconv('UTF-8', 'US-ASCII//TRANSLIT', $original_string);