×
          
              
          
      
      Clear all filters including search bar
          
        Valeri Tandilashvili's Personal Professional Blog
      
    emptyisset$var = 0;
// Evaluates to true because $var is empty
if (empty($var)) {
    echo '$var is either 0, empty, or not set at all';
}
// Evaluates as true because $var is set
if (isset($var)) {
    echo '$var is set even though it is empty';
}""00.0"0"NULLFALSEarray().btn-block<button type="button" class="btn btn-primary btn-lg btn-block">Block level button</button>
<button type="button" class="btn btn-secondary btn-lg btn-block">Block level button</button>
composer remove vendor/package vendor/package2
// Example usage:
$year = 2023;
$month = 1; // May
function generateMonthArray($year, $month) {
    $numDays = cal_days_in_month(CAL_GREGORIAN, $month, $year);
    $firstDay = date("N", strtotime("$year-$month-01")); // 1 = Monday, 7 = Sunday
    $weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
    $monthArray = array_fill_keys($weekdays, []);
    for ($day = 1; $day <= $numDays; $day++) {
        $weekday = ($firstDay + $day - 2) % 7; // Adjust to start from Monday
        $monthArray[$weekdays[$weekday]][] = $day;
    }
    
    foreach ($monthArray as &$weekDays) {
    	if ($weekDays[0]!=1) {
    		array_unshift($weekDays, '');
    	} else {
    		break;
    	}
    }
    return $monthArray;
}
$result = generateMonthArray($year, $month);
// Print the result
foreach ($result as $weekday => $days) {
    echo $weekday . "\t" . implode("\t", $days) . "\n";
}
scriptspackage.json"scripts": {
    "start": "node app.js",
    "server": "live-server"
}npm run startnode app.jsnpm run serverlive-serverprintMe()echo printMe();
function printMe() {
    return 'Print some text';
}conditional functionfoo()if ($makefoo)$makefoo = true;
/* We can't call foo() from here 
   since it doesn't exist yet,
   but we can call bar() */
// foo();
bar();
if ($makefoo) {
  function foo()
  {
    echo "I don't exist until program execution reaches me.\n";
  }
}
/* Now we can safely call foo()
   since $makefoo evaluated to true */
if ($makefoo) foo();
function bar() 
{
  echo "I exist immediately upon program start.\n";
}bar()foo()function foo() 
{
  function bar() 
  {
    echo "I don't exist until foo() is called.\n";
  }
}
/* We can't call bar() yet
   since it doesn't exist. */
// bar();
foo();
/* Now we can call bar(),
   foo()'s processing has
   made it accessible. */
bar();class Foo {
    
    public function __call($function, $arguments)
    {
        return "$function has been called with arguments: " . implode(', ', $arguments); 
    }
    
    // public function fireFunction($one, $two, $three) {
    //     return "pre-defined method";
    // }
}
$foo = new Foo();
echo $foo->fireFunction(5, 47, "third argument");__call__get__setclass Foo {
    protected $properties = array();
    public function __get( $key )
    {
        if(array_key_exists($key, $this->properties)){
            return $this->properties[$key];
        }
        return $this->properties[ $key ];
    }
    public function __set( $key, $value )
    {
        $this->properties[ $key ] = $value;
    }
}
$foo = new Foo();
$foo->name = 'David';
echo $foo->name;propertiesvariableVARiffunction callMePlease() {
  if (1 == 1) {
    let variableLET = 'LET'
    var variableVAR = 'VAR'
  }
  document.write('My ' + variableVAR + '</br>')
  document.write('My ' + variableLET + '</br>')
}
callMePlease()variableLETUncaught ReferenceError: variableLET is not definedhreftext//calling the function in window.onload to make sure the HTML is loaded
window.onload = function() {
    var el = document.getElementsByTagName('a');
    el[0].href= 'http://www.sololearn.com';
};<a href="http://www.example.com">Some link</a>
<br />
<a href="https://google.com">Google.com</a>