variables

Eclipse completions - @var (PHPDoc) question

心已入冬 提交于 2020-01-02 06:32:49
问题 I have strange problem. When I use @return Model\Article in the model-loading method then I see the model's methods in autocomplete of Eclipse. The model-loading method returns more objects so I want it to @return My\BaseModel and then put the /* @var $model Model\Article */ for each model specificaly (when I use it). The problem is that the @return Model\Article works well (I see Model\Article + My\BaseModel methods) but the other way ( @return My\BaseModel and inline /*...*/ ) doesn't - it

PHP: cast to (array) and return-type: array is not the same?

房东的猫 提交于 2020-01-02 06:19:52
问题 I have following problem in PHP: print_r() says it's the same, gettype() says same type, but the last output works not for both cases although they should be the same! This looks very strange to me. code and output: $docdatau = get_object_vars(json_decode($docdata)); $docdatau2 = (array)json_decode($docdata); echo "1\n"; echo gettype($docdatau); echo "\n"; echo "--------------------------------------\n"; print_r($docdatau); echo "--------------------------------------\n"; echo "2\n"; echo

PHP: cast to (array) and return-type: array is not the same?

☆樱花仙子☆ 提交于 2020-01-02 06:19:11
问题 I have following problem in PHP: print_r() says it's the same, gettype() says same type, but the last output works not for both cases although they should be the same! This looks very strange to me. code and output: $docdatau = get_object_vars(json_decode($docdata)); $docdatau2 = (array)json_decode($docdata); echo "1\n"; echo gettype($docdatau); echo "\n"; echo "--------------------------------------\n"; print_r($docdatau); echo "--------------------------------------\n"; echo "2\n"; echo

PHP: cast to (array) and return-type: array is not the same?

試著忘記壹切 提交于 2020-01-02 06:18:07
问题 I have following problem in PHP: print_r() says it's the same, gettype() says same type, but the last output works not for both cases although they should be the same! This looks very strange to me. code and output: $docdatau = get_object_vars(json_decode($docdata)); $docdatau2 = (array)json_decode($docdata); echo "1\n"; echo gettype($docdatau); echo "\n"; echo "--------------------------------------\n"; print_r($docdatau); echo "--------------------------------------\n"; echo "2\n"; echo

How many variable can I use in Batch File

狂风中的少年 提交于 2020-01-02 06:13:23
问题 I am a little curious about how many variable I can set in Batch File. I have a little script here @ECHO OFF SETLOCAL EnableDelayedExpansion FOR /L %%P IN (1,1,2147483647) DO ( SET Foo[%%P]=%%P ECHO !Foo[%%P]! ) But this script would take forever to run. So, is there any way to find out variable amount limit? (and of course how many variable can be used in Batch file.) EDIT: Since comment below says that var. Amount may vary due to different OS. So if you would answer, use Windows 7 64bit w/

is it bad practice to use variable variables in php in the following fashion?

喜你入骨 提交于 2020-01-02 05:43:06
问题 For example, a simple mvc type system: /api/class/method rewritten into php variables using .htaccess/nginx.conf then doing something like: <?php // Set up class + method variables $className = some_class_filter($_GET['class']); $method = some_method_filter($_GET['method']); // Check if class exists and execute if(file_exists(BASE . "/controllers/" . $className . ".class.php")) { require BASE . "/controllers/" . $className . ".class.php"; $$className = new $className(); // Execute the method

T-SQL Table name alias

笑着哭i 提交于 2020-01-02 04:51:48
问题 In my T-SQL script, I refer to same long table name several times. I use this query on different tables. Is there a way to refer a table name by variable? If so, I can simple declare one variable at the top which script will use and just by setting value, I can run it on various tables without making changes in the script. 回答1: You could create a synonym for that table but obviously you'd need to make sure that nobody changed the definition of the synonym whilst the script was running (and no

memory allocation for objects

空扰寡人 提交于 2020-01-02 04:41:28
问题 When we instantiate a variable in c++ like int x within a function(i.e. x is a local variable), it is allocated on top of stack of the process. But if we do int *x= new int , the space is provided in heap. So, my questions are: What about objects of different classes (classes provided by c++ or user defined)? Where are their objects instantiated? For example: Let Employee is a class and we declare Employee emp; . Where is emp given space-> on stack or in heap? If the declaration int a[4] is

C# Pointers in a Method's arguments?

泄露秘密 提交于 2020-01-02 02:43:15
问题 I wish to directly modify a variable's value outside of a method from inside it. Pointers are the way, correct? How? 回答1: No. In c# you can apply pass by reference semantics using the ref or out modifiers: void Foo( ref string s, ref int x ) { s = "Hello World"; // caller sees the change to s x = 100; // caller sees the change to x } // or, alternatively... void Bar( out string s ) { s = "Hello World"; } The difference between these two, is that with out , the caller does not have to specify

Arguments with Powershell Scripts on Launch

廉价感情. 提交于 2020-01-02 02:35:12
问题 Like in C and other languages, you can give to the script/.exe arguments when you physically execute the script. For example: myScript.exe Hello 10 P Whereby Hello, 10 and P are passed to some variable in the program itself. Is this possible in Powershell? and if so, how do you give those args to a given $variable Thanks! 回答1: Define your script with a param block like so: -- Start of script foo.ps1 -- param($msg, $num, $char) "You passed in $msg, $num and $char" You can further type qualify