# Hiding PHP Text

**URL:** <https://forum.kirupa.com/t/hiding-php-text/154383>\
**Category:** programming\
**Created:** [July 9, 2005, 2:15am UTC](https://forum.kirupa.com/t/hiding-php-text/154383 "2005-07-09T02:15:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![deathBydsgn](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@deathBydsgn](https://forum.kirupa.com/u/deathBydsgn)\
**Post date:** [July 9, 2005, 2:15am UTC](https://forum.kirupa.com/t/hiding-php-text/154383/1 "2005-07-09T02:15:46Z")

</div>

Dilemma:

I am using external text files from .swf files, which is not a problem. However, I have built a client backend that allows the client to edit the .txt files.

These files start with ‘myText=’ and end with ‘&’

I have already run into problems with the client either deleting those strings or screweing them up somehow, so I changed it so that when the file saves, it adds the strings at the front and end of the file.

But when the client opens the file, I want those two strings deleted from the file when they open it to edit. How can I do a simple find and replace before the file shows up?

I am kinda new to php, but here is my code:

```php
if(($user == $u || $user == "") && $edit) // if an edit link was clicked
{
	$fp = fopen($path.$pathext.$edit, "rw");
	$oldcontent = fread($fp, filesize($path.$pathext.preg_replace($patterns, $replacements).$edit));
	$string = $oldcontent;
	$patterns[0] = '/myText=/';
	$patterns[1] = '/&/';
	$replacements[1] = '';
	$replacements[0] = '';
	
	fclose($fp);
	

```
