-
last of the implodes
28 Oktsometimes implode is not enough. if you’re working with text that users should read and you have a set (read array) of items that you want to join to a single string you probably think about something like “merge all the items with a comma and the last one with something different”. unfortunately php doesn’t have that built-in even though it’s a pretty common thing to do in templates.
snippets to the win. here’s what does the job (and is pretty fast):
function lastImplode($glue, $lastGlue, $data) { return implode($glue, array_slice($data, 0, -1)) . $lastGlue . end($data); }Usage:
lastImplode(", ", " and ", array("Admin", "CEO", "Misc")); -
LESS Compiler Service
18 Oktrunning on http://farbdev.org:1355/
see
curl http://farbdev.org:1355/for instructions ;) -
Neues WordPress Plugin für Kontaktformulare
15 MaiNachdem ich eine Weile im Pluginverzeichnis von WordPress gestöbert habe auf der Suche nach einer brauchbaren und einfachen Erweiterung, bin ich selbst ans Werk gegangen. Andere Lösungen versprachen zwar häufig intuitiv zu sein und sowieso und überhaupt super einfach, entschuldigten sich aber kurzerhand auch gleich wieder für die Komplexität. Sogar Werbung habe ich mehrfach gesehen.
Am Ende des Tages bin ich dann selbst mit einer Lösung fertig geworden. Ob ich sie ins Pluginverzeichnis eintragen lasse, weiß ich noch nicht. Da ich es auf dieser Seite nutze, verspreche ich aber jedenfalls Updates ;).
Download und git finden sich auf der Projektseite.
