Codeigniter Parse Error Syntax Error Unexpected T_double_arrow
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the syntax error unexpected t_double_arrow in php company Business Learn more about hiring developers or posting ads with us Stack Overflow syntax error, unexpected '=>' (t_double_arrow) laravel Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7
Unexpected T_double_arrow Php
million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up php - syntax error, unexpected T_DOUBLE_ARROW [duplicate] up vote 0 down vote favorite This question already has an answer
Syntax Error Unexpected T_double_arrow In Codeigniter
here: PHP Parse/Syntax Errors; and How to solve them? 10 answers how i can rid of this error?? Parse error: syntax error, unexpected T_DOUBLE_ARROW in /var/www/core/restvt.api.php on line 35 PHP Code : $datax = Array(); foreach ($inis as $key => $data){ if ($data=="mem"){ $str = number_format($ARRAY[(array_search($data.':',$ARRAY)+2)]/1024,0,',','.')." MB [ ".number_format(($ARRAY[(array_search($data.':',$ARRAY)+2)]/$ARRAY[(array_search($data.':',$ARRAY)+1)])*100,0,',','.')." % ]"; array_push($datax, "mem"=>$str); //error here, why? }else{ array_push($datax,$data=>$ARRAY[(array_search($data.':',$ARRAY)+1)]); } } $jsonr = json_encode($datax); thx alot for your help... php syntax share|improve this question syntax error, unexpected '=>' (t_double_arrow) yii2 edited Dec 4 '13 at 2:00 asked Dec 4 '13 at 1:50 Andi Doank 6113 marked as duplicate by Cupcake, rahilwazir, Brilliand, Divi, Shankar Damodaranphp Users with the php badge can single-handedly close php questions as duplicates and reopen them as needed. Jun 7 '14 at 2:01 This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. "mem"=>$str <--- what's this? –zerkms Dec 4 '13 at 1:53 variable string value from other array, i add for some string into it... –Andi Doank Dec 4 '13 at 1:57 add a comment| 2 Answers 2 active oldest votes up vote 3 down vote accepted I hate seeing people use array_push - I know it's legal. In this case, you can't push a key => value to your array, just do this instead: $datax['mem'] = $str; Manual: http://php.net/manual/en/function.array-push.php edit If you insist on using the array_push type method, you'll need to create a new array with your new key value pair then use array_merge to join them: $new_data = array('mem' => $str); $datax = array_merge($datax, $new_data); share|improve this answer answered Dec 4 '13 at 2:05 Robbie Averill 15.2k42562 add a comment| up vote 3 down vote The error is af
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or
Php Syntax Error Unexpected
posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss syntax error, unexpected '[', expecting ')' Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only parse error in php takes a minute: Sign up syntax error, unexpected T_DOUBLE_ARROW [closed] up vote -3 down vote favorite how can i rid of this error Parse error: syntax error, unexpected T_DOUBLE_ARROW PHP code: $uniqueOrderCodes = array(); foreach ($checks as $check) { array_push($uniqueOrderCodes,"string" http://stackoverflow.com/questions/20365334/php-syntax-error-unexpected-t-double-arrow => $check); } thanx alot php arrays syntax array-push share|improve this question asked Dec 23 '12 at 19:51 Mohammad Masoudian 988 closed as not a real question by Charles, Niko, PeeHaa, Ricardo Alvaro Lohmann, bensiu Dec 24 '12 at 2:05 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the http://stackoverflow.com/questions/14014201/syntax-error-unexpected-t-double-arrow help center.If this question can be reworded to fit the rules in the help center, please edit the question. 3 Don't use array_push(). just set the key: $uniqueOrderCodes['string'] = $check; –Michael Berkowski Dec 23 '12 at 19:53 Can you look at related questions, search in Google or anything? It's parse error... –pamil Dec 23 '12 at 19:53 But since this is in a loop, you're overwriting string on every iteration! Please let us know what you are trying to acheive. –Michael Berkowski Dec 23 '12 at 19:53 2 @MohammadMasoudian That is not valid. You cannot use the same key string multiple times in the array. Do you mean that you want it to be a string type? To get what you want, you just need to append to the array and it will be numerically indexed. $uniqueOrderCodes[] = $check; –Michael Berkowski Dec 23 '12 at 19:55 1 @MohammadMasoudian PHP cannot produce an array like that. It will overwrite the string key. What web service is this? –Michael Berkowski Dec 23 '12 at 19:58 | show 6 more comments 1 Answer 1 active oldest votes up vote 2 down vote accepted No offense intended, but you should read the manual. => it is an assignment operator and is used in arrays. In the example $my_array = array('color' => 'blue'), color is the key, blue is the value (of type string) and $my_array is th
Detected You currently have javascript disabled. Several functions may not work. Please re-enable javascript to access full functionality. [SOLVED] Parse error: syntax error, unexpected https://forums.phpfreaks.com/topic/171273-solved-parse-error-syntax-error-unexpected-t-double-arrow/ T_DOUBLE_ARROW Started by mattclements, Aug 21 2009 09:28 AM Please log in to reply 2 replies to this topic #1 mattclements mattclements Advanced Member Members 84 posts LocationLetchworth, Hertfordshire, UK Posted 21 August 2009 - 09:28 AM Hey all I am getting the following error: Parse error: syntax error, unexpected T_DOUBLE_ARROW with this code - seems like im missing something stupid! 08) && (date("d") < 15) ) { echo "selected"; }; ?> Matt Web Designer/PHP Developer/Server Admin Back to top #2 Garethp Garethp Advanced Member Members 1,026 posts LocationSydney, Australia Posted 21 August 2009 - 09:36 AM Shouldn't => be ==? I don't know much about =>, but it seems like it could syntax error unexpected be that. Also, ; does not go after } The Three Rules of Getting Assistance1. Google first2. Ask second3. Then buy me some chocolate Back to top #3 mattclements mattclements Advanced Member Members 84 posts LocationLetchworth, Hertfordshire, UK Posted 21 August 2009 - 09:41 AM Sorted it - Should be >= rather than =>=> is to do with setting arrays.Matt Web Designer/PHP Developer/Server Admin Back to top Back to PHP Coding Help · Next Unread Topic → 1 user(s) are reading this topic 0 members, 1 guests, 0 anonymous users Reply to quoted postsClear PHP Freaks → PHP Coding → PHP Coding Help Privacy Policy Forum Rules & Terms of Service · Change Theme IP.Board Mobile PHP Freaks PHP Freaks - English (USA) English (USA) PHP Freaks - English (USA) Mark Community Read Forums Members Pages Mark all as read Help Community Forum Software by IP.BoardLicensed to: PHP Freaks Sign In Use Facebook Use Twitter Need an account? Register now! Username Password I've forgotten my password Remember me This is not recommended for shared computers Sign in anonymously Don't add me to the active users list Privacy Policy