Spread argumnts function functionName(...$nums) [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 days ago.
Improve this question
I made a spread and it converts the Parameter to the array. it works fine but I don't understand how it happened.
The Code under below ::
function ava (...$nums){
return $nums;
}
Print_r (ava(100, 100, 100, 100));
also have a question of spread can be used with string by PHP ?

Related

Determine source of code that is making a query [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Exist any way to know the source page that is calling the query and store it?
Are you looking for $_SERVER['PHP_SELF'] ?
Check also print_r($_SERVER) if something is more accurate for what you need

Send array to JSON PHP [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I got these arrays
$address = array("1JzSZFs2DQke2B3S4pBxaNaMzzVZaG4Cqh", "12Cf6nCcRtKERh9cQm3Z29c9MWvQuFSxvT", "1dice6YgEVBf88erBFra9BHf6ZMoyvG88")
$amount= array("100000000","150000000","200000000")
and I want to convert them to json format like below:
{
"1JzSZFs2DQke2B3S4pBxaNaMzzVZaG4Cqh": 100000000,
"12Cf6nCcRtKERh9cQm3Z29c9MWvQuFSxvT": 1500000000,
"1dice6YgEVBf88erBFra9BHf6ZMoyvG88": 200000000
}
I tried too much but couldn't figure out how to do that in PHP, any ideas?
Use array_combine:
echo json_encode(array_combine($address, array_map('intval', $amount)));

get HTTP_AF_REMOTE_ADDR [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I had a very important question
How do you get HTTP_AF_REMOTE_ADDR
What code and what version?
Run
echo $_SERVER['HTTP_AF_REMOTE_ADDR'];
error
Undefined index: HTTP_AF_REMOTE_ADDR -- at line 1
{
answered me;
my server limit
}
Many options:
$_SERVER['HTTP_AF_REMOTE_ADDR'];
filter_input(INPUT_SERVER, 'HTTP_AF_REMOTE_ADDR');
Second is preferable.

Is there a way to have my webpage automatically load a preselected page once a certain php function is complete [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Essentially the title, please keep it simple, im not accustom with code.
You can use header('Location:yourpage.php') at the end of your function.
Header

PDO PHP how to customize header function [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
is there any way i can get the id inside this code:
header('Location: assigned.php?success?$ticket_id');
I am new to PDO. sorry for the simple question
You are adding ? twice. it should be like..
header('Location: assigned.php?success='.$ticket_id);

Categories