$lines) array_shift($data); break; } #### # III. Add the line at the end. array_push( $data, empty($lastname) ? sprintf( "[%s:%s] %s : %s", date("H"), date("i"), $firstname, # Don't normalize the name. $message ) : sprintf( "[%s:%s] %s %s : %s", date("H"), date("i"), ucfirst( strtolower( $firstname ) ), ucfirst( strtolower( $lastname ) ), $message ) ); #### # IV. Now dump the array to the file. atomized_put_contents( $chatFile, implode( PHP_EOL, $data ) ); }