Using php to Auto generate C++ code
<p>SCROLL DOWN if you just want to see the question without much explanation</p>

<p>I have kind of a big application with a lot of values that are used as options. The control for the application is a website, application itself is C++ and all the options are stored inside MySQL so that both C++ and php can access it.
So I am using php to read bunch of values from a text file, and auto generate SQL, C++ and php code, since the options are used everywhere and are so massive that it would take too long to implement them, and would be too much of a hassle to add an extra options in the future.</p>

<p>This is what one line of my text file looks like</p>

<pre><code>`input_video_standard`|:|INT|:|NOT NULL DEFAULT '0'|:|profile-&gt;input.videoStandard|:|Video Standard|:|SD 576i@50Hz (B,G/PAL)|:|SD 480i@59.94Hz (NTSC)|:|HD 720p@50Hz|:|HD 720p@59.94Hz|:|HD 1080i@25Hz|:|HD 1080i@29.97Hz
</code></pre>

<p>Once I read in that line I use</p>

<pre><code>$pieces = explode("|:|", $line);
</code></pre>

<p>This part is for generating C++ code now
I have an array called variables, where I store name of the variable for C++ and what type it is.</p>

<pre><code>$variables[] = array($pieces[1], $pieces[3]);
</code></pre>

<p>Once I loop through the text file and gather up all the data</p>

<p>I try to create a string which I will later on store inside a text file</p>

<pre><code>$cpp .= "memset(prof,0,sizeof(prof));\n";
$cpp .= "sprintf(prof, \"CALL put_into_input(%d, 'test'";
for($i = 3; $i&lt;count($variables); $i++)
{
    if(strpos($variables[0], "VARCHAR") === FALSE)
    {
        $cpp .= ", %d";
    }
    else
    {
        $cpp .= ", '%s'";
    }
}
$cpp .= "\nprofile-"."&gt;"."pfile";
for($i = 3; $i&lt;count($variables); $i++)
{
    $cpp .= ",\n".$variables[1];
}
$cpp .= ");\n";
</code></pre>

<p><strong>THE QUESTION</strong></p>

<p>The problem is that when I try to concatenate string <em>profile->input.videoStandard</em> to my main string it simply saves it as Array, and I have noticed that php does not like -> as a string in general, which is why I used <em>"-".">"</em> wherever I could. How do I go about getting php of accepting -> as a string?</p>

<p>Thanks to anyone for their help.</p>
