Parse Error Syntax Error Unexpected T_double_arrow Php Array
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
Syntax Error, Unexpected '=>' (t_double_arrow) Laravel
of this site About Us Learn more about Stack Overflow the company Business syntax error unexpected t_double_arrow in codeigniter Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges
Syntax Error, Unexpected '=>' (t_double_arrow) Yii2
Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: unexpected > Sign up php - syntax error, unexpected T_DOUBLE_ARROW [duplicate] up vote 0 down vote favorite This question already has an answer 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 php syntax error unexpected ($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 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 4 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
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
Parse Error In Php
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions syntax error, unexpected '[', expecting ')' Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers,
Array_push In Php
just like you, helping each other. Join them; it only 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 http://stackoverflow.com/questions/20365334/php-syntax-error-unexpected-t-double-arrow error, unexpected T_DOUBLE_ARROW PHP code: $uniqueOrderCodes = array(); foreach ($checks as $check) { array_push($uniqueOrderCodes,"string" => $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 http://stackoverflow.com/questions/14014201/syntax-error-unexpected-t-double-arrow cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the 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 of
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 http://stackoverflow.com/questions/9789831/parse-error-unexpected-t-double-arrow-foreach-array-assignment the company Business Learn more about hiring developers or posting ads with us Stack Overflow http://stackoverflow.com/questions/5933793/unexpected-t-double-arrow-php Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Parse Error: unexpected T_DOUBLE_ARROW => foreach array assignment up vote 2 down vote favorite I am trying to create syntax error an associative array that collects the following (existing on the db) information using this code: $pro_xp = array();//array declaration foreach ($profile_professional_experiences as $each_professional_experience) { $pro_xp[] = ('title' => $each_professional_experience->title, 'company' => $each_professional_experience->company, 'industry' => $eachprofessional_experience->industry, 'time_period' => $each_professional_experience->time_period, 'duration' => $each_professional_experience->duration);} This current code wins me a Parse Error message, which is not productive for me. I have seen other assignment questions, but none like this. I'm still new to PHP development, syntax error unexpected so if this is a rookie mistake, that would be why. php arrays foreach syntax-error share|improve this question asked Mar 20 '12 at 15:33 Waddler 162315 5 I think if you look again, you will find you forgot the word array... –DaveRandom Mar 20 '12 at 15:33 I didn't think I needed it since I had declared it above. I thought I was placing those items into the array at that position. BUT, I have to place an array (with those items) into my original array. –Waddler Mar 20 '12 at 15:47 You still need the array keyword. You are creating a sub-array, but it is still a new array. $var = ('val', 'val'); is not a valid PHP syntax. –DaveRandom Mar 20 '12 at 15:49 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote accepted foreach ($profile_professional_experiences as $each_professional_experience) { $pro_xp[] = array(' share|improve this answer answered Mar 20 '12 at 15:34 mgraph 12.4k22354 Thanks. That got me rolling again. –Waddler Mar 20 '12 at 15:45 add a comment| up vote 0 down vote $pro_xp[] = array('title' => $each_professional_experience->title, ^^^^^---add this without the array bit, PHP doens't know you want an array. Something like $x = ("Hello"); is perfectly valid, but isn't d
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 posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up unexpected T_DOUBLE_ARROW PHP up vote 0 down vote favorite I have a problem which i do not see on line 9 of my code (which is the second line for you guys). I searched stackoverflow for it, but the problem still seems to be hiding for me... Code is: $otsi_array( 'soiduki_tuup' => array( '' => 'Kõik', '4X4' => '4X4', 'Kaubik C' => 'Kaubik C', 'MAHTUNIVERSAAL' => 'MAHTUNIVERSAAL', 'Motoroller' => 'Motoroller', 'Sõiduauto' => 'Sõiduauto', 'Traktor' => 'Traktor', 'Veoauto' => 'Veoauto' ); All help is appreciated. php arrays share|improve this question asked May 9 '11 at 7:22 CodeInACan 267 add a comment| 4 Answers 4 active oldest votes up vote 5 down vote accepted Pay attention to the syntax... array ( '' => 'Kõik', '4X4' => '4X4', 'Kaubik C' => 'Kaubik C', 'MAHTUNIVERSAAL' => 'MAHTUNIVERSAAL', 'Motoroller' => 'Motoroller', 'Sõiduauto' => 'Sõiduauto', 'Traktor' => 'Traktor', 'Veoauto' => 'Veoauto' ) ); ?> share|improve this answer answered May 9 '11 at 7:26 Fabio Mora 2,77921227 2 sigh, such thing was between my eyes? darn me. I'm really sorry for wasting your time guys and thanks! –CodeInACan May 9 '11 at 7:35 add a comment| up vote 3 down vote You're missing an array declaration: $otsi_array = array( 'soiduki_tuup' => array( ... ) ); share|improve this answer answered May 9 '11 at 7:23 deceze 304k44386531 add a comment| up vote 2 down vote $otsi = array( 'soiduki_t