What do you want to save?
Add Code snippet
New code examples
-
PHP 2021-09-24 09:57:02
php count string in array
<?php $a[0] = 1; $a[1] = 3; $a[2] = 5; var_dump(count($a)); $b[0] = 7; $b[5] = 9; $b[10] = 11; var_dump(count($b)); var_dump(count(null)); var_dump(count(false)); ?> /* result int(3) int(3) Warning: count(): Parameter must be an array... Add solution -
PHP 2021-09-23 12:45:04
interview php questions
# 27 basics questions for php Interview 1) What is PHP? PHP is a web language based on scripts that allow developers to dynamically create generated web pages. 2) What do the initials of PHP stand for? PHP means PHP: Hypertext Preprocessor. 3) Which pr... Add solution -
PHP 2021-09-22 11:07:04
get file name from file path in php
<?php $path_parts = pathinfo('/www/htdocs/inc/lib.inc.php'); echo $path_parts['dirname'], "\n"; echo $path_parts['basename'], "\n"; echo $path_parts['extension'], "\n"; echo $path_parts['filename'], "\n"; // sin... Add solution -
PHP 2021-09-17 22:15:04
array associativo php
<?php /* There are 3 Types of array in php 1. Indexed arrays - Arrays with a numeric index 2. Associative arrays - Arrays with named keys 3. Multidimensional arrays - Arrays containing one or more arrays This is the second one - Associative arrays... Add solution -
PHP 2021-09-17 06:12:03
wordpress wpdb
<?php // 1st Method - Declaring $wpdb as global and using it to execute an SQL query statement that returns a PHP object global $wpdb; $results = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}options WHERE option_id = 1", OBJECT ); Add solution -
PHP 2021-09-15 19:56:03
how to create config file in php
<?php return (object) array( 'host' => 'localhost', 'username' => 'root', 'pass' => 'password', 'database' => 'db' ); ?> This allows you to use the object syntax when you include the php : $configs->host instead o... Add solution