Jump to content

[SOLVED] Another preg_replace question


maxudaskin

Recommended Posts

I wrote this, but it won't seem to work for me. I want to (let * be a variable) take the first variable from code one and put them into another array. There may be multiple instances that I want to take (lets say each line has a different variable that I want to take).

 

[" * "]*²[/" * "]
[" * "]*²[/" * "]
[" * "]*²[/" * "]

 

I got this, but it gives me an error.

<?php
/*******************************************/
/*                                         */
/*         Written by Max Udaskin          */
/*                                         */
/*          max.udaskin@gmail.com          */
/*                                         */
/*******************************************/
/*                                         */
/*    No part of this script may be used   */
/* without written consent of the original */
/*     author himself and nobody else.     */
/*                                         */
/*******************************************/

// Open, Read and Close the file
$file     = fopen("constants.txt","r");
$contents = fread($file,filesize("constants.txt"));
fclose($file);

// Set Variables
$varnames = preg_replace("/\[(.+?)\]/*\[/(.+?)]/","$1\n",$output);
echo $output;
?>

Warning: preg_replace() [function.preg-replace]: Unknown modifier '\' in /home/.grable/vzoom/virtualzoom.net/email/emailer.php on line 22

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.