Skip to content
Magenaut

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

variadic-functions

How to pass variable number of arguments to a PHP function

October 20, 2022 by Magenaut

I have a PHP function that takes a variable number of arguments (using func_num_args() and func_get_args()), but the number of arguments I want to pass the function depends on the length of an array. Is there a way to call a PHP function with a variable number of arguments?

Categories PHP, Q&A Tags php, variadic-functions Leave a comment

PHP Spread Syntax in Array Declaration

October 15, 2022 by Magenaut

PHP supports the spread syntax for variadic functions.

Categories PHP, Q&A Tags arrays, php, spread-syntax, variadic-functions Leave a comment

PHP: variable-length argument list by reference?

October 14, 2022 by Magenaut

Is it possible to create a PHP function that takes a variable number of parameters all of them by reference?

Categories PHP, Q&A Tags function-parameter, parameter-passing, pass-by-reference, php, variadic-functions Leave a comment

What does ** (double star/asterisk) and * (star/asterisk) do for parameters?

August 22, 2022 by Magenaut

What do *args and **kwargs mean?

Categories Python, Q&A Tags argument-unpacking, parameter-passing, python, syntax, variadic-functions Leave a comment

Python, default keyword arguments after variable length positional arguments

August 15, 2022 by Magenaut

I thought I could use named parameters after variable-length positional parameters in a function call in Python 2, but I get a SyntaxError when importing a python class. I’m writing with the following “get” method, for example:

Categories Python, Q&A Tags default-parameters, named-parameters, python, python-2.x, variadic-functions Leave a comment

Recent Comments

  • silverplugins217 on How to add placeholder for contact form7 for dropdown?
  • Shreyas Ikhar on How to add a custom CSS class to core blocks in Gutenberg editor?
  • Magenaut on How to call function on timer ASP.NET MVC
  • Ebaad Uddin on How to call function on timer ASP.NET MVC
  • michealSmith07 on Is there a way to dynamically refresh the less command?

Tags

.net adobe-illustrator adobe-photoshop ajax arrays asp.net asp.net-core asp.net-mvc bash c# css database django eloquent express html java javascript jquery json laravel laravel-4 laravel-5 laravel-8 linux list mongodb mongoose mysql node.js npm pandas php python python-3.x react-hooks react-native react-router reactjs redux regex sql string typescript wordpress
© 2023 Magenaut • Built with GeneratePress