Posts

php interview question logical

 <!DOCTYPE html> <html> <body> <?php // First question factorial 5  $num = 5; $value = 1;  for($i= $num ; $i > 1; $i--){     $value = $i * $value ;  } echo $value; // second q highest and smallest number $arr = [10,12,14,145,56,5]; //echo "<br/>" .  count($arr); $smallest = $arr[$i];  $highest =1; for($i=0; $i < count($arr); $i++){    if($smallest > $arr[$i]){           $smallest = $arr[$i];     }elseif($highest < $arr[$i]){        $highest = $arr[$i];    } } echo  'Smallest value is ' .   $smallest."<br/>"; echo 'Highest value is ' . $highest."<br/>"; ?> <?php $number = 37521. echo $number."<br/>"; echo $number++ ."<br/>" + $number++  ."<br/>"; echo $number ."<br/>"; echo $number-- - $number--."<br/>"; echo $number."<br/>"; ?> </body> </html>...

mail configration code

  MAIL_MAILER =smtp MAIL_HOST =smtp.gmail.com MAIL_PORT =587 MAIL_USERNAME = MAIL_PASSWORD = MAIL_ENCRYPTION =tls MAIL_FROM_ADDRESS = "" MAIL_FROM_NAME = "${APP_NAME}"

React js 7/12/2024

 1. use Module.js  for import and export. module is ES6 features. 2. for install react using vite npm create vite@latest . -- --template=react 

Laravel Important Links ...

 1. faker use   Link:https://www.interserver.net/tips/kb/laravel-with-faker/ 2. Insta Mojo Payment gateway. Link:https://www.tutsmake.com/instamojo-payment-gateway-integration-in-laravel-8/

search vowels from name in php

 <!DOCTYPE html> <html> <body> <?php $str = "Rupesh sharma"; $counter = 0; for($i=0; $i<=strlen($str); $i++){  if(in_array($str[$i],['a', 'e' , 'i','o','u'])){      $counter++;  }         } echo $counter; ?> </body> </html>

Interview question laravel.

 1. for table use  protected $table = "mytablename" ; 2. difference between post  from web and api . sol. @csrf token 3.  diff web.php and api.php  sol. https://koenwoortman.com/laravel-difference-between-web-and-api-routes/ 4. many to many relation 5. patch and put = multiple column update in put and update single column in patch . 6.  show single variable in all view files. sol: https://stackoverflow.com/questions/32683069/how-to-make-a-variable-available-to-all-my-pages-in-laravel 7. how many table use in one to one                                           one to many                                           many  to many  

My Sql Query ..

 1.  select product_id from products where low_fats = 'Y' && recyclable = 'Y' ; 2. select name from customer where referee_id != 2 || referee_id is null ; 3. select name, population , area from world where area > 3000000 or population > 25000000 ; 4. select distinct author_id as id from Views where author_id = viewer_id order by id; 5. select tweet_id from tweets where char_length (content) > 15 ; 6. select unique_id, name from Employees left join EmployeeUNI on Employees.id = EmployeeUNI.id; 7. select customer_id , count (visits.visit_id) as count_no_trans from visits left join transactions on visits.visit_id = transactions.visit_id where transaction_id is null group by customer_id; 8. SELECT w1.id FROM Weather w1, Weather w2 WHERE DATEDIFF(w1.recordDate, w2.recordDate) = 1 AND w1.temperature > w2.temperature;