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          */
/*                                         */
/*          [email protected]          */
/*                                         */
/*******************************************/
/*                                         */
/*    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
https://forums.phpfreaks.com/topic/111431-solved-another-preg_replace-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.