ON DELETE CASCADE not deleting entry for foreign key
Aftee searching the Ideone FAQ, it seems that it uses Sqlite3 for the SQL language.
Sqlite needs PRAGMA foreign_keys = ON; to enable foreign keys checks. As they say in their docs: SQLite Foreign Key Support :

Assuming the library is compiled with foreign key constraints enabled, it must still be enabled by the application at runtime, using the PRAGMA foreign_keys command. For example:
sqlite&gt; PRAGMA foreign_keys = ON;


Tested at: Ideone