|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-03-30 19:15 UTC] schmidtzilla at outlook dot com
Description: ------------ $round = [ 'round' => empty($current) ? 1 : $current['round'] + 3, 'type' => 'Public', 'starts' => empty($current) ? $_SERVER['REQUEST_TIME'] : floor($_SERVER['REQUEST_TIME'] / 86400) * 86400 + 72000, 'ends' => floor($_SERVER['REQUEST_TIME'] / 86400) * 86400 + 72000 + 864000, 'speed' => 25, 'build' => 2500, 'credits' => 4294967295, 'jackpot' => 100 ]; lLater on in code.. $round = [ 'round' => $current['round'] + 1, 'type' => 'Speed', 'starts' => floor($_SERVER['REQUEST_TIME'] / 86400) * 86400 + 72000, 'ends' => floor($_SERVER['REQUEST_TIME'] / 86400) * 86400 + 72000 + 172800, 'speed' => 100, 'build' => 2500, 'credits' => 0, 'jackpot' => 50 ]; If the same variable is already assigned with different values 'type' => 'Speed' now equals 25 because it's now assuming I am calling onto the variable $round['speed'] instead of wanting the string 'Speed' and inputs it into its place. Expected result: ---------------- I expect the $round = [ 'type' => 'Speed' ] to put the string Speed into the index 'type' of the $round variable instead of the value of $round['speed'] Actual result: -------------- $round['type] = 25; instead of $round['type'] = 'Speed'; PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 21 11:00:02 2025 UTC |
$db->exec("INSERT INTO rounds (type, starts, ends, speed, build, credits, jackpot) VALUES ($round[type], $round[starts], $round[ends], $round[speed], $round[build], $round[credits], $round[jackpot])"); Gives it a value of 25 because $round[type] is the string 'Speed' which when echoed out inside my exec without quotes inside of it is now fetching the default value of the databases speed column which happened to be 25 in the database and it inserted that value into the type column! Very much expected results! PHP is awesome! :D