What do you want to save?
Add Code snippet
New code examples
-
PHP 2022-03-24 01:20:09
how to run foreach for the entire array except for one line in php
There are multiple ways of approaching this problem. The first solution is to use a flag boolean to indicate the first element and proceed in your foreach $firstElement = true; foreach($array as $key => $val) { if($firstElement) { $firstEl... Add solution -
Javascript 2022-03-17 07:35:13
8.3.1. Common Array Methods // join Examples (.join)
//The general syntax for this method is: arrayName.join('connector') /*join combines all the elements of an array into a string. The connector determines the string that "glues" the array elements together.*/ let arr = [1, 2, 3, 4]; let word... Add solution -
C# 2022-02-06 00:50:41
encrypption in C# console using mod of 26
namespace CaesarCipher { class Program { static void Main(string[] args) { // Determining if user wants to encrypt or decrypt. Console.WriteLine("Chose One: Encrypt / Decrypt"); string encryptDecrypt = Console.ReadL... Add solution -
Javascript 2022-02-01 12:06:57
8.3.1. Common Array Methods // sort Examples (.sort)
//The general syntax for this method is: arrayName.sort() /*This method arranges the elements of an array into increasing order. For strings, this means alphabetical order. HOWEVER, the results are not always what we expect.*/ let letters = ['f', 'c',... Add solution -
PHP 2021-11-18 00:12:15
Using the PHPExcel library to read an Excel file and transfer the data into a database
// Include PHPExcel_IOFactory include 'PHPExcel/IOFactory.php'; $inputFileName = './sampleData/example1.xls'; // Read your Excel workbook try { $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory::cre... Add solution -
PHP 2021-11-10 21:42:15
csv to json php
<?php //Open our CSV file using the fopen function. $fh = fopen("names.csv", "r"); //Setup a PHP array to hold our CSV rows. $csvData = array(); //Loop through the rows in our CSV file and add them to //the PHP ... Add solution -
PHP 2021-10-30 04:08:13
online password generator in php
<?php function randomPassword() { $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789"; $pass = array(); //remember to declare $pass as an array $alphaLength = strlen($alphabet) - 1; //put the length -1 in ca... Add solution -
Javascript 2021-10-28 01:58:07
array sorting javascript mergesort
// Merge Sort (Recursive) function mergeSort (unsortedArray) { // No need to sort the array if the array only has one element or empty if (unsortedArray.length <= 1) { return unsortedArray; } // In order to divide the array in half, we need... Add solution