Questions tagged [create-function]
114 questions
-1
votes
3 answers
How can I create a function to find the average of a list?
I'm trying to create a functional for the average of a list that accepts three parameters: a mandatory list of numbers, an optional minimum value which defaults to zero, and an an optional maximum value which defaults to 100. The function should…

tatertot007
- 9
- 1
-1
votes
1 answer
PHP: Replace this create_function
this old php script I pasted from the internet is no longer supported. create_function no longer works and I would like to replace it. However I'm not capable of finding a modern solution. My PHP skills are too bad to even understand how this used…

Foolix
- 3
- 4
-1
votes
2 answers
Why are there 2 parentheses after Function
function sample(banana)
{return new Function('return ' + banana)() }
Why are there 2 parentheses after Function?
Is the first parenthese the argument for the newly created function.?
What does the second parentheses do?

Steven Chen
- 27
- 5
-1
votes
1 answer
Create JavaScript function on onload image
Is it possible to create a function in the onload event of an image? Is there a method that makes this possible?


Spiderpoison
- 95
- 2
- 9
-1
votes
1 answer
Function create_function() is deprecated PHP 7.2.1
since I update I get this messege but I just used a Snippet in this case and do not understand the code. There fore I do not know to change it to be right.
Can someone help me with this please?
Code:

Christian Zimpel
- 1
- 3
-1
votes
1 answer
error using $this on create_function
When I'm using $this inside create_function I'm getting an error
Fatal error: Using $this when not in object context
create_function('$model, $this', 'return $this->di->getStatus($model->getStatus)');
Later on I call it like
$function($model,…

user2035693
- 193
- 2
- 16
-1
votes
2 answers
PostgreSQL: CREATE FUNCTION returns one row by primary key
I wrote the following function:
-- Authenticate: Get session_id with user_id
CREATE OR REPLACE FUNCTION sessions_get(bigint) RETURNS SETOF char(32) AS
$$
SELECT strip_hyphens(id) as id FROM sessions WHERE user_id = $1;
$$
LANGUAGE SQL;
I want…

ma11hew28
- 121,420
- 116
- 450
- 651
-1
votes
1 answer
Function Create but Statement is Ignored
Hello everyone, please help me again!
I could create the function but when I execute it, I always get the following error. Line 1, column 7 (I guess it's datatype of parameter) and statement ignored! :(

Vera Aung
- 85
- 1
- 1
- 10
-7
votes
2 answers
Can someone help me resolve an sql syntax error on pgadmin while creating a function?
First Attempt -
CREATE FUNCTION rental_quarter (rental_date TIMESTAMP)
RETURNS VARCHAR(7)
BEGIN
IF MONTH(rental_date) BETWEEN 1 AND 3 THEN RETURN YEAR(rental_date)+ ”Q1”;
ELSE IF MONTH(rental_date) BETWEEN 4 AND 6 THEN RETURN YEAR(rental_date)+…

KB_Wonderland
- 1
- 2