Questions tagged [declare]

Use this tag for questions related to declare, which is usually meant for declaring variables, statements, etc.

736 questions
0
votes
2 answers

PHP misunderstanding number of tickable statements using PHP ticks?

I know what ticks are in PHP, but looking at the output of the following code: "; $n++; } register_tick_function("myfunc"); declare(ticks=1); echo 'echo
'; The output…
tonix
  • 6,671
  • 13
  • 75
  • 136
0
votes
1 answer

Confusion with Structures and how to store values with pointer in C

This question may be annoying, but I am trying to write code the way that I can most easily mentally process it and at this point it is without calling functions. I am rewriting my professors example code into my own, but am having a problem with…
Casey
  • 67
  • 1
  • 6
0
votes
1 answer

Is it possible to declare variables in a constructor [Java]

I have been tasked to declare variables in a constructor but I am not sure how I can go about with this. The request states: "In the constructor, create the Startrek Asteroids Resort given in the Appendix(see…
Bantu Tech
  • 234
  • 4
  • 15
0
votes
1 answer

MySQL Trigger User Declared Variables

Hi I'm trying to declare some user defined variables (EX: @var) for a SQL trigger that Sums the values in the selected rows for a given subscriberID. However, I'm getting a Syntax error on my DECLARE statement. Here is my code: DELIMITER // …
wUmpage
  • 165
  • 2
  • 17
0
votes
1 answer

Declare variables returned with symvar (MATLAB)

I'm trying to declare a function (n-dimensional) and its variables from an input, regardless of how many variables I have in this function. Example: input_func = '3*x*y^2 + x^3 -3*x' I use symvar to get these variables and it works just fine: >>…
0
votes
2 answers

Declare dynamic Variables from a table

I want to DECLARE my dynamic SQL Variables form a table. Basically I have a "Assumptions" Table like that City BranchID Name London 101 London Branch Munich 102 Munich Branch I've already tried this: DECLARE @Cit varchar(75) SET @Lob =…
Johanna
  • 15
  • 5
0
votes
0 answers

PHP declare encoding gives fatal error?

Example #3 of Php manual's declare(encoding) (source) has this snippet of code: However, when I tried to run the exact code above, it doesn't work: Fatal error: Encoding declaration pragma…
Pacerier
  • 86,231
  • 106
  • 366
  • 634
0
votes
1 answer

C++ take a user input as the number of dimensions an array has?

I can't seem to find anything regarding whether or not this is possible. Ideally I'd have someone input an integer like "4" and then it would make a 4-d array. is this at all possible?
0
votes
2 answers

Search all tables for a column AND return max length for the columns

I need to make sure all columns that involve usernames have a max length of 140 characters. I'm fairly new to SQL, and I'm curious how you would do this. I'm starting by returning a list of all tables that contain relevant column names. At the same…
Defpotec2020
  • 257
  • 2
  • 18
0
votes
1 answer

Nested if-statement in MySQL

I am making a procedure that inserts a place ("Sted") and I would like to check if the inputs are NULL. However, whenever I try to add an if-statement at the start to surround my code (marked CRASH below), it gives me an error saying my syntax is…
PWL
  • 456
  • 4
  • 27
0
votes
5 answers

Fixed date with variable year (SQL Server)

I'm trying to set a fixed date every year for last year, this year & next year, eg 1st November. I can declare my years declare @lastyear int; set @lastyear = year (getdate()-365) declare @thisyear int; set @thisyear = year (getdate()) …
Mike
  • 537
  • 1
  • 8
  • 18
0
votes
2 answers

Calloc for an array of array with negative index in C

I have an array of array with negative index. It is an array which has real dimensions [dim_y + 40][dim_x + 40] but the user uses the array like it has dimensions [dim_y][dim_x]. First i had global and already defined the dimensions dim_x, dim_y, so…
user3143155
  • 49
  • 1
  • 6
0
votes
4 answers

problems declaring bool false in class

boolean.cpp: Boolean::Boolean() : test1(false),test2(false) { } void Boolean::exec() { test1 = true; test2 = true; if ((!test1) && (!test2)) std::cout << "both test1 && test2 are false" << std::endl; else std::cout << "test1 is "…
user3480913
0
votes
1 answer

wordpress: how to include a php file in frontend AND admin area (Fatal error: Cannot redeclare myfunction())

I have some troubles to include a file called myplugin_functions.php This php file contains functions that are required to make some functions work in the wordpress admin area. For that reason I include this file in backend pages using: include(…
Ben Spi
  • 816
  • 1
  • 11
  • 23
0
votes
4 answers

Auto implement properties in inherited form

I'm creating a form to manage the reports of my application, the idea is that every report form inherits from this base form. My problem is that it contains several properties that HAVE to be assigned and i need to verify on every child form if I…
a.daw
  • 21
  • 4