Re: how to combine the results of two variables to echo another variable?



Ewoud Dronkert wrote:
Sacs wrote:

Variable variables:
http://www.php.net/manual/en/language.variables.variable.php


Yes. But why......:


Variable variables are one of the most powerfull features of php I've found. Very usefull when you dont know how many variables to be processed in a form for e.g.


for( $i=1; $i <= $num_fields; $i++) {
      $blah = "field_" . $i;
      // $blah is now "field_1" first time through the loop

      $blah = $$blah;
      // now $blah holds what was input into the appropriate input
}

echo '<form>
      <input type=text name="field_1">
      <input type=text name="field_2">
      <input type=text name="field_3">
      <input type=hidden name="num_fields" value=3>
      <input type=submit>
      </form>';



$fooboo = "$a" . "$b";


Just do: $fooboo = $a . $b;

With just $fooboo = $a . $b; then $fooboo is set to "foobar" not "blah blah" as op wanted.

Sacs
.



Relevant Pages

  • Re: [Full-disclosure] Secure Delete for Windows
    ... i dont agree with some points though. ... > rather an observation that it is typical business practice to treat ... > even the most annoying potential customer with respect. ... >> my god if you dont have anything usefull to say, ...
    (Full-Disclosure)
  • Re: 8mm Mauser chamberings ???
    ... Blah, blah, blah... ... I may be a craxy american but I am not stupid. ... Am I patronizing you, yes just a little, but light hearted please dont ... The Mauser design is one of the best the world has ever seen. ...
    (rec.guns)
  • Re: YES NO Logon Script
    ... Has anyone got any ideas i know Message Manager Deluxe does it but its like $500 and we dont have the type of budget. ... I am looking to find a way to make a login script that displays a message box just before explorer.exe is loaded that shows a yes and no button for example, ... Blah, Blah blah ... bad example but its to get end users to agree to terms and conditions if they press no then the system logs off without loading explorer.exe so maybe a script that is invoked before explorer.exe loads that halts the loading process until either yess or no is pressed. ...
    (microsoft.public.windows.server.scripting)
  • Re: Janica Kostelic interview on NBC
    ... dont want to talk, blah, blah"... ... Sounds like a PR pitch to me. ... She's seriously sick. ...
    (rec.skiing.alpine)
  • Re: FS: Atari Roadblaster, Peter Packrat, RoadRunner, Marble Madness, Indiana Jones, +
    ... Vids sure are dead forever I guess.... ... dont ... I would keep them but......blah blah blah.. ... Looks like the Road Runner CPO and System One Sideart are taken. ...
    (rec.games.video.arcade.collecting)