Run php from command line without script file
Do you want to run a quick php script, a line or two, without having file? Thanks for PHP’s cute command line option you can do that.
If you have some file the way to run it, as you know would be
php file.php
But without file if you want to run a simple function like date then use -r option
php -r "echo date();"
would do the trick
Also if you want to get explanation on some built-in function
php --rf strtoupper
would give you an explanation that is something like
Function [ function strtoupper ] { - Parameters [1] { Parameter #0 [ $str ] } }
For more use php –help!!
See how you would solve these known algorithm problems
Get maximum occurring characterFlatten nested javascript array
Kadane’s algorithm in C – Dynamic Programming
find longest word in the sentence
Check if there are three numbers a, b, c giving a total T from array A
Find the first occurence of number in the sorted array
Finding missing numbers from billion sequential number list file
testing k complementary pairs algorithm with junit
binary tree problems with solution
String Ordered Permutation Algorithm Problem