输出数组不加单引号

WBOY
Release: 2016-06-23 14:00:52
Original
1046 people have browsed it

//数据库连接 $rs = mysql_query("select id,degree,min,max,prize,v from magic_config"); 	while($r = mysql_fetch_assoc($rs)) {  	$prize_arr[] = $r; } 
Copy after login

如何让输出的数组其中的 degree获取的数字不加单引号呢?

$prize_arr = array( 		array('id'=>'1','degree'=>97,'min'=>'1','max'=>'5','prize'=>'不要放弃','v'=>'1'), 		array('id'=>'2','degree'=>98,'min'=>'7','max'=>'35','prize'=>'不要灰心','v'=>'1'),); 
Copy after login

只 97 98 这样的不要单引号


回复讨论(解决方案)

或者只数字不加 中文加? 要怎么写?

$prize_arr = array(         array('id'=>'1','degree'=>97,'min'=>'1','max'=>'5','prize'=>'不要放弃','v'=>'1'),         array('id'=>'2','degree'=>98,'min'=>'7','max'=>'35','prize'=>'不要灰心','v'=>'1'),); foreach ($prize_arr as $key => $value) {	$prize_arr[$key]['degree'] = (int) $value['degree'];}var_dump($prize_arr);
Copy after login
Copy after login
Copy after login
Copy after login

其实没必要转的 php是弱语言字符和整形没多大区别

这方面需要

$prize_arr = array(         array('id'=>'1','degree'=>97,'min'=>'1','max'=>'5','prize'=>'不要放弃','v'=>'1'),         array('id'=>'2','degree'=>98,'min'=>'7','max'=>'35','prize'=>'不要灰心','v'=>'1'),); foreach ($prize_arr as $key => $value) {	$prize_arr[$key]['degree'] = (int) $value['degree'];}var_dump($prize_arr);
Copy after login
Copy after login
Copy after login
Copy after login

其实没必要转的 php是弱语言字符和整形没多大区别
我也不想这么麻烦 degree 加了单引 就不能用了 无语

//数据库连接 $rs = mysql_query("select id,degree,min,max,prize,v from magic_config");     while($r = mysql_fetch_assoc($rs)) {      $prize_arr[] = $r; } foreach ($prize_arr as $key => $value) {    $prize_arr[$key]['degree'] = (int) $value['degree'];}var_dump($prize_arr);
Copy after login
Copy after login
Copy after login
这样行吗

这方面需要


$prize_arr = array(         array('id'=>'1','degree'=>97,'min'=>'1','max'=>'5','prize'=>'不要放弃','v'=>'1'),         array('id'=>'2','degree'=>98,'min'=>'7','max'=>'35','prize'=>'不要灰心','v'=>'1'),); foreach ($prize_arr as $key => $value) {	$prize_arr[$key]['degree'] = (int) $value['degree'];}var_dump($prize_arr);
Copy after login
Copy after login
Copy after login
Copy after login

其实没必要转的 php是弱语言字符和整形没多大区别
我也不想这么麻烦 degree 加了单引 就不能用了 无语

//数据库连接 $rs = mysql_query("select id,degree,min,max,prize,v from magic_config");     while($r = mysql_fetch_assoc($rs)) {      $prize_arr[] = $r; } foreach ($prize_arr as $key => $value) {    $prize_arr[$key]['degree'] = (int) $value['degree'];}var_dump($prize_arr);
Copy after login
Copy after login
Copy after login
这样行吗
恩 可以的 加引号为啥不能用啊

是'degree'=> 97 97这个值不要单引


这方面需要


$prize_arr = array(         array('id'=>'1','degree'=>97,'min'=>'1','max'=>'5','prize'=>'不要放弃','v'=>'1'),         array('id'=>'2','degree'=>98,'min'=>'7','max'=>'35','prize'=>'不要灰心','v'=>'1'),); foreach ($prize_arr as $key => $value) {	$prize_arr[$key]['degree'] = (int) $value['degree'];}var_dump($prize_arr);
Copy after login
Copy after login
Copy after login
Copy after login

其实没必要转的 php是弱语言字符和整形没多大区别
我也不想这么麻烦 degree 加了单引 就不能用了 无语

//数据库连接 $rs = mysql_query("select id,degree,min,max,prize,v from magic_config");     while($r = mysql_fetch_assoc($rs)) {      $prize_arr[] = $r; } foreach ($prize_arr as $key => $value) {    $prize_arr[$key]['degree'] = (int) $value['degree'];}var_dump($prize_arr);
Copy after login
Copy after login
Copy after login
 这样行吗
恩 可以的 加引号为啥不能用啊
是'degree'=>97     97这个值不要单引 

是'degree'=> 97     97这个值不要单引
结果不对吗?


是'degree'=> 97     97这个值不要单引
结果不对吗?

太感谢你啦!!  把var_dump($prize_arr);去掉就能用了 !!  



是'degree'=> 97     97这个值不要单引
结果不对吗?

太感谢你啦!!  把var_dump($prize_arr);去掉就能用了 !!  
但其实真的没必要转的 你应该改那个程序 让他字符和整形都兼容




是'degree'=> 97     97这个值不要单引
结果不对吗?

太感谢你啦!!  把var_dump($prize_arr);去掉就能用了 !!  
但其实真的没必要转的 你应该改那个程序 让他字符和整形都兼容

我还要多学习啊!! 谢谢你啦!! 终于可以搞定睡觉啦!!    晚安~~

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template