An anonymous function is a function (or a subroutine) defined, and possibly called, without being bound to a name. In lambda calculus, all functions are anonymous. The Y combinator can be utilised in these circumstances to provide anonymous recursion. Certain programming languages also provide support for both named and anonymous functions. The lambda calculus without anonymous function definition forms a combinatory logic.
Some object-oriented programming languages have anonymous classes, which are a similar concept. Java is such a language.
Examples
Numerous languages support anonymous functions, or something similar.
Python
foo = lambda x: x*x
print foo(10)
PHP
PHP doesn't have true anonymous functions because the only way to reference functions is by name. The closest PHP is shown in the following.
$foo = create_function("$x", "return $x*$x;");
echo $foo(10);