btwael / mammouth

Unfancy PHP
http://mammouth.boutglay.com
MIT License
214 stars 22 forks source link

Dynamically created fields #19

Closed CezaryDanielNowak closed 10 years ago

CezaryDanielNowak commented 10 years ago

Is this possible to make support for dynamically created fields ?

<?php
  $row = new stdClass(); // I use (object)array() instead of new stdClass() but type casting won't work in mammouth
  $fieldName = 'blabla';

  $row->{$fieldName} = ':)'; // this line
  var_dump($row);
?>
btwael commented 10 years ago

@korpirkor, What do you exactly mean with dynamically created fields?? can you write what we should write in Mammouth (suggestion example)??

CezaryDanielNowak commented 10 years ago

row.{fieldName} = ':)'

btwael commented 10 years ago

Use row{fieldName} = ':)' : http://mammouth.wamalaka.com/#try:{{%0Arow{fieldName}%20%3D%20%27%3A%29%27%0A}}

CezaryDanielNowak commented 10 years ago

perfect ! You're on fire :)

btwael commented 10 years ago

thanks you @korpirkor, you are a the best tester for Mammouth