Loading...
More PHP Posts
<?php$array = array('fruit1' => 'apple','fruit2' => 'orange','fruit3' => 'grape','fruit4' => 'apple','fruit5' => 'apple');// this cycle echoes all associative array// key where value equals "apple"while ($fruit_name = current($array)) {if ($fruit_name == 'apple') {echo key($array), "\n";}next($array);}?>
<?phpfunction getRandomId($min = NULL, $max = NULL) {if (is_numeric($min) && is_numeric($max)) {return mt_rand($min, $max);}else {return mt_rand();}}?>
<?phpfunction uniqidReal($length = 8) {// uniqid gives 8 chars, can be changedif (function_exists("random_bytes")) {$bytes = random_bytes(ceil($length / 2));} elseif (function_exists("openssl_random_pseudo_bytes")) {$bytes = openssl_random_pseudo_bytes(ceil($length / 2));} else {throw new Exception("no cryptographically secure random function available");}return substr(bin2hex($bytes), 0, $length);}/*//for testingfor($i = 0; $i < 10; $i++) {echo "<br>";echo uniqidReal();}*/?>
<?php$listOfFiles = glob("*.{jpg,png,gif,tiff,jpeg}", GLOB_BRACE);echo 'images = []; ';for($x = 0; $x <= count($listOfFiles)-1; $x++) {echo "images[" . $x . "] =" . '"' . $listOfFiles[$x] . '"' . "; ";}?>
<?php$username = "Austin Leath -_#";$username_err = "no error";if(preg_match('/[^a-z_\-0-9]/i', $string)) {$username_err = "Username can only contain alphanumeric characters, dashes, and underscores.";}echo $username_err?>
<?phpecho '<select id="modeEl" size="1"><option value="abap">ABAP</option><option value="abc">ABC</option><option value="actionscript">ActionScript</option><option value="ada">ADA</option><option value="alda">Alda</option><option value="apache_conf">Apache Conf</option><option value="apex">Apex</option><option value="aql">AQL</option><option value="asciidoc">AsciiDoc</option><option value="asl">ASL</option><option value="assembly_x86">Assembly x86</option><option value="autohotkey">AutoHotkey / AutoIt</option><option value="batchfile">BatchFile</option><option value="c_cpp">C and C++</option><option value="c9search">C9Search</option><option value="cirru">Cirru</option><option value="clojure">Clojure</option><option value="cobol">Cobol</option><option value="coffee">CoffeeScript</option><option value="coldfusion">ColdFusion</option><option value="crystal">Crystal</option><option value="csharp">C#</option><option value="csound_document">Csound Document</option><option value="csound_orchestra">Csound</option><option value="csound_score">Csound Score</option><option value="css">CSS</option><option value="curly">Curly</option><option value="d">D</option><option value="dart">Dart</option><option value="diff">Diff</option><option value="dockerfile">Dockerfile</option><option value="dot">Dot</option><option value="drools">Drools</option><option value="edifact">Edifact</option><option value="eiffel">Eiffel</option><option value="ejs">EJS</option><option value="elixir">Elixir</option><option value="elm">Elm</option><option value="erlang">Erlang</option><option value="forth">Forth</option><option value="fortran">Fortran</option><option value="fsharp">FSharp</option><option value="fsl">FSL</option><option value="ftl">FreeMarker</option><option value="gcode">Gcode</option><option value="gherkin">Gherkin</option><option value="gitignore">Gitignore</option><option value="glsl">Glsl</option><option value="gobstones">Gobstones</option><option value="golang">Go</option><option value="graphqlschema">GraphQLSchema</option><option value="groovy">Groovy</option><option value="haml">HAML</option><option value="handlebars">Handlebars</option><option value="haskell">Haskell</option><option value="haskell_cabal">Haskell Cabal</option><option value="haxe">haXe</option><option value="hjson">Hjson</option><option value="html">HTML</option><option value="html_elixir">HTML (Elixir)</option><option value="html_ruby">HTML (Ruby)</option><option value="ini">INI</option><option value="io">Io</option><option value="jack">Jack</option><option value="jade">Jade</option><option value="java">Java</option><option value="javascript">JavaScript</option><option value="json">JSON</option><option value="json5">JSON5</option><option value="jsoniq">JSONiq</option><option value="jsp">JSP</option><option value="jssm">JSSM</option><option value="jsx">JSX</option><option value="julia">Julia</option><option value="kotlin">Kotlin</option><option value="latex">LaTeX</option><option value="latte">Latte</option><option value="less">LESS</option><option value="liquid">Liquid</option><option value="lisp">Lisp</option><option value="livescript">LiveScript</option><option value="logiql">LogiQL</option><option value="lsl">LSL</option><option value="lua">Lua</option><option value="luapage">LuaPage</option><option value="lucene">Lucene</option><option value="makefile">Makefile</option><option value="markdown">Markdown</option><option value="mask">Mask</option><option value="matlab">MATLAB</option><option value="maze">Maze</option><option value="mediawiki">MediaWiki</option><option value="mel">MEL</option><option value="mips">MIPS</option><option value="mixal">MIXAL</option><option value="mushcode">MUSHCode</option><option value="mysql">MySQL</option><option value="nginx">Nginx</option><option value="nim">Nim</option><option value="nix">Nix</option><option value="nsis">NSIS</option><option value="nunjucks">Nunjucks</option><option value="objectivec">Objective-C</option><option value="ocaml">OCaml</option><option value="pascal">Pascal</option><option value="perl">Perl</option><option value="pgsql">pgSQL</option><option value="php">PHP</option><option value="php_laravel_blade">PHP (Blade Template)</option><option value="pig">Pig</option><option value="powershell">Powershell</option><option value="praat">Praat</option><option value="prisma">Prisma</option><option value="prolog">Prolog</option><option value="properties">Properties</option><option value="protobuf">Protobuf</option><option value="puppet">Puppet</option><option value="python">Python</option><option value="qml">QML</option><option value="r">R</option><option value="raku">Raku</option><option value="razor">Razor</option><option value="rdoc">RDoc</option><option value="red">Red</option><option value="rhtml">RHTML</option><option value="rst">RST</option><option value="ruby">Ruby</option><option value="rust">Rust</option><option value="sass">SASS</option><option value="scad">SCAD</option><option value="scala">Scala</option><option value="scheme">Scheme</option><option value="scss">SCSS</option><option value="sh">SH</option><option value="sjs">SJS</option><option value="slim">Slim</option><option value="smarty">Smarty</option><option value="smithy">Smithy</option><option value="snippets">snippets</option><option value="soy_template">Soy Template</option><option value="space">Space</option><option value="sql">SQL</option><option value="sqlserver">SQLServer</option><option value="stylus">Stylus</option><option value="svg">SVG</option><option value="swift">Swift</option><option value="tcl">Tcl</option><option value="terraform">Terraform</option><option value="tex">Tex</option><option value="text">Text</option><option value="textile">Textile</option><option value="toml">Toml</option><option value="tsx">TSX</option><option value="twig">Twig</option><option value="typescript">Typescript</option><option value="vala">Vala</option><option value="vbscript">VBScript</option><option value="velocity">Velocity</option><option value="verilog">Verilog</option><option value="vhdl">VHDL</option><option value="visualforce">Visualforce</option><option value="wollok">Wollok</option><option value="xml">XML</option><option value="xquery">XQuery</option><option value="yaml">YAML</option><option value="zeek">Zeek</option><option value="django">Django</option></select>';?>