在php中,我经常需要使用数组来映射变量......但我似乎无法在一个内联中执行此操作.cf示例:
// the following results in an error:
echo array('a','b','c')[$key];
// this works, using an unnecessary variable:
$variable = array('a','b','c');
echo $variable[$key];
Run Code Online (Sandbox Code Playgroud)
这是一个小问题,但它每隔一段时间就会不停地窃听......我不喜欢这样一个事实:我没有使用变量;)
如何在SQL结果从一个变量复制其他无阵列和foreach在PHP.
$query="Select * from table";
$res1=mysql_query($query);
$res2=$res1; // I need somethink like this, simply, like in other languages
while($row=mysql_fetch_array($res1)) {
echo $row['Id'];
}
echo '<br>';
while($row=mysql_fetch_array($res2)) {
echo $row['Id'];
}
Run Code Online (Sandbox Code Playgroud)
首先将打印id,第二次不打印.
我正在使用核心情节,我收到了一个错误
"'*** -[UIView setHostedLayer:]: unrecognized selector sent to instance 0xf283a0'"
Run Code Online (Sandbox Code Playgroud)
在线
hostingView.hostedLayer = graph;
Run Code Online (Sandbox Code Playgroud)