Jump to content

TripleDES

Members
  • Posts

    64
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

TripleDES's Achievements

Member

Member (2/5)

0

Reputation

  1. Ahh...I needed this: '\\0' Can you explain the significance of \\0, \\1, etc..??
  2. Still doesn't work: $myarray = "i am [[happy]] today"; $pattern = "/\[\[.+?\]\]*/ie"; foreach ($myarray as $val) { $val = preg_replace($pattern, "strtoupper('\\1')", $val); print $val . "\n"; }
  3. Bumping this thread. I have a similar scenario. See this string: $subject = "i am [[happy]] today"; I'd like to only change happy to uppercase. $pattern = "/\[\[.+?\]\]*/"; preg_replace($pattern, strtoupper(??whatdoidohere??), $val);
  4. Got it. Thanks for your help and Neil's on this. I appreciate it!!
  5. eval() does work, but I'd like to know why akitchin recommended against it.
  6. I tried that too, but no workie. By the way, why do you recommend against using eval()? $begin = 'i_ar[\'NEW:'; $end = '\'][0]'; echo $$newline; PHP Notice: Undefined variable Seems that will only work if I define $i_ar['NEW:THIS'][0]; beforehand.
  7. [line] => [[THIS]] [newline] => $i_ar['NEW:THIS'][0] Running this gets me an undefined variable error: echo $$newline; But running this gets me the value I'm looking for: echo $i_ar['NEW:THIS'][0];
  8. I tried it that way, but I get this. PHP Notice: Undefined variable
  9. I didn't want to overcomplicate the question, but here it goes. I'm trying to pull values from a string (eventually will be a file) that contains delimiters within [[]]. The index from an array I'm pulling is exactly the name of [[]]. So in this case, [[THIS]] can be called with $i_ar['NEW:THIS][0] and return a value. I'm replacing [[ with $i_ar['NEW: and ]] with ][0]. So instead of displaying the string, I want the value of the array called. Hope this clarifies it a bit and thanks for the help!! $template = 'Replace [[THIS]] and [[THISTOO]]'; $parser = xml_parser_create (); $ipinfo = implode ("", file("xml.txt")); xml_parse_into_struct($parser, $ipinfo, $d_ar, $i_ar); preg_match_all('/\[\[.+?\]\]/', $template, $matches); $begin = '$i_ar['NEW:'; $end = '\'][0]'; foreach ($matches[0] as $line) { $newline = str_replace('[[', '', $line); $newline = str_replace(']]', '', $newline); echo "$begin$newline$end"; }
  10. Thanks for the quick reply. Okay, here's more information: $begin = '$c['NEW:'; $end = '\'][0]'; $newline = str_replace('[[', '', $line); $newline = str_replace(']]', '', $newline); echo "$begin$newline$end"; Gives me: $c['NEW:Array'][0] Instead of the value
  11. How do I go about calling a variable that is stored as a string? For example, I have a variable called: $a = '$newvariable'; Now when I call upon $a, I'd like the value in $newvariable to be called instead of being interpreted as a string. Any ideas?
  12. Thanks. I've tried the hidden input and the session to no avail. Still does this: 20080709.100331 and then: 20080709.100335 Very odd. Maybe too many moving parts. Here's what I have so far. The sflow function calls cURL to a web site. if (!isset($_SESSION['tstamp'])) { session_start(); $_SESSION['tstamp'] = date('Ymd.His'); } $ordnum = $_POST['ordernumber']; $serialnum = $_POST['serialnumber']; if (isset($ordnum)) { $flowname = "SRP"; $fresult = sflow($flowname); } Then I have a AJAX reading the file: var fileName = myWan + '\-' + myDate; function status() { var myAjax = new Ajax.PeriodicalUpdater('status', 'readfile.php?fname=' + fileName, {method: 'get', frequency: 5.0, decay: 1}); }
  13. I'm using the following as part of a unique ID: $timestamp = date('Ymd.His'); However, I'm noticing the timestamp is getting set twice. First when the page loads and second when the is submitted. What can I do to only use the timestamp generated at page load?
  14. But the value I want for the variable is the value of the input. Would this still work?
  15. Hopefully, this is a simple question. How do I go about setting a variable (PHP/Javascript) so when a user clicks out of a text field, it's immediately assigned? Thanks!
×
×
  • 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.