Skip to content

Instantly share code, notes, and snippets.

@macwinnie
macwinnie / analyse texts old
Last active October 22, 2018 20:45 — forked from phpfiddle/fiddle_038149.php
[ Posted by Martin ] Word analysing in texts
<?php
$analyze = '';
$punctuations = '.:-,;–_?!';
if (isset($_POST['analyze']) and trim($_POST['analyze']) != '') {
$analyze = $_POST['analyze'];
$analyzed = preg_replace( "/\s+/", " ", $analyze );
$len = strlen($analyze);
$pl = strlen($punctuations);
for ($i=0; $i < $pl; $i++) {
$analyzed = str_replace($punctuations[$i], ' ', $analyzed);