Welcome back to shortlearner.com,today we will see how to say “HELLO WORLD” In 25 different programming languages.
there is no perfect programming language , they all offer something a little bit different, and there are hundreds of programming languages with new ones
being created everyday.
Say Hello World in 25 different programming
How to check filesize using PHP.
Welcome back to shortlearner.com . Today we will see how to check the size of specified file.
PHP provide us an inbuilt function that is filesize() function.
the filesize() function returns the size of the file in bytes on success or
false on failure.
How to append a string using PHP
Welcome Back to Shortlearner.com, today we will see how to append a string with the help of php.
in the previous tutorial we see How to Concatenate two or more string in PHP By using Concatenation assignment operator(.=) we can append a string
How to Concatenate two or more string in PHP
Welcome back to shortlearner.com, today we will see How to Concatenate two or more string in PHP.
each and every language has their different way to works with strings, in below example we concatenate two strings using php with the help of concatenation operator(“.”)
there is an another way to append a string in PHP.
Print Numbers from 1 to N without using loop in PHP
Welcome back to shortlearner.com, today we will learn how to print 1 to N number without using any type of loop.
In this tutorial we print 1 to N number with the help of some php functions like range() and array_walk.
The range() function is used to create an array of elements of any kind such as integer, alphabets within a given range(from low to high) i.e, list’s first element is considered as low and last one is considered as high.
syntax of range function is like
array range(low, high, step)
It returns an array of elements from low to high.
for example
<?php $numbers = range(0, 100); print_r($numbers); ?>
array_walk()
The array_walk() function apply a user defined function to every element of an array. The user-defined function takes array’s values and keys as parameters.
<?php $array = range(1, 100); array_walk($array, function ($value) { echo "$value"; }); ?>
and the another way to print 1 to N number is
<?php print_number(1); function print_number($number) { if($number > 100) { return; } else { echo "$number"; echo "<br/>"; print_number(++$number); } } ?>